statistics.hh (6227:a17798f2a52c) statistics.hh (6977:039202aafc0d)
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 478 unchanged lines hidden (view full) ---

487 * being watched. This is good for keeping track of residencies in structures
488 * among other things.
489 */
490class AvgStor
491{
492 private:
493 /** The current count. */
494 Counter current;
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 478 unchanged lines hidden (view full) ---

487 * being watched. This is good for keeping track of residencies in structures
488 * among other things.
489 */
490class AvgStor
491{
492 private:
493 /** The current count. */
494 Counter current;
495 /** The tick of the last reset */
496 Tick lastReset;
495 /** The total count for all tick. */
496 mutable Result total;
497 /** The tick that current last changed. */
498 mutable Tick last;
499
500 public:
501 struct Params : public StorageParams {};
502
503 public:
504 /**
505 * Build and initializes this stat storage.
506 */
507 AvgStor(Info *info)
497 /** The total count for all tick. */
498 mutable Result total;
499 /** The tick that current last changed. */
500 mutable Tick last;
501
502 public:
503 struct Params : public StorageParams {};
504
505 public:
506 /**
507 * Build and initializes this stat storage.
508 */
509 AvgStor(Info *info)
508 : current(0), total(0), last(0)
510 : current(0), lastReset(0), total(0), last(0)
509 { }
510
511 /**
512 * Set the current count to the one provided, update the total and last
513 * set values.
514 * @param val The new count.
515 */
516 void

--- 25 unchanged lines hidden (view full) ---

542 /**
543 * Return the current average.
544 * @return The current average.
545 */
546 Result
547 result() const
548 {
549 assert(last == curTick);
511 { }
512
513 /**
514 * Set the current count to the one provided, update the total and last
515 * set values.
516 * @param val The new count.
517 */
518 void

--- 25 unchanged lines hidden (view full) ---

544 /**
545 * Return the current average.
546 * @return The current average.
547 */
548 Result
549 result() const
550 {
551 assert(last == curTick);
550 return (Result)(total + current) / (Result)(curTick + 1);
552 return (Result)(total + current) / (Result)(curTick - lastReset + 1);
551 }
552
553 /**
554 * @return true if zero value
555 */
556 bool zero() const { return total == 0.0; }
557
558 /**

--- 9 unchanged lines hidden (view full) ---

568 /**
569 * Reset stat value to default
570 */
571 void
572 reset(Info *info)
573 {
574 total = 0.0;
575 last = curTick;
553 }
554
555 /**
556 * @return true if zero value
557 */
558 bool zero() const { return total == 0.0; }
559
560 /**

--- 9 unchanged lines hidden (view full) ---

570 /**
571 * Reset stat value to default
572 */
573 void
574 reset(Info *info)
575 {
576 total = 0.0;
577 last = curTick;
578 lastReset = curTick;
576 }
577
578};
579
580/**
581 * Implementation of a scalar stat. The type of stat is determined by the
582 * Storage template.
583 */

--- 1962 unchanged lines hidden (view full) ---

2546 /**
2547 * Create a new VectorStatNode.
2548 * @param s The VectorStat to place in a node.
2549 */
2550 Temp(const Vector &s)
2551 : node(new VectorStatNode(s.info()))
2552 { }
2553
579 }
580
581};
582
583/**
584 * Implementation of a scalar stat. The type of stat is determined by the
585 * Storage template.
586 */

--- 1962 unchanged lines hidden (view full) ---

2549 /**
2550 * Create a new VectorStatNode.
2551 * @param s The VectorStat to place in a node.
2552 */
2553 Temp(const Vector &s)
2554 : node(new VectorStatNode(s.info()))
2555 { }
2556
2557 Temp(const AverageVector &s)
2558 : node(new VectorStatNode(s.info()))
2559 { }
2560
2554 /**
2555 *
2556 */
2557 Temp(const Formula &f)
2558 : node(new FormulaNode(f))
2559 { }
2560
2561 /**

--- 193 unchanged lines hidden ---
2561 /**
2562 *
2563 */
2564 Temp(const Formula &f)
2565 : node(new FormulaNode(f))
2566 { }
2567
2568 /**

--- 193 unchanged lines hidden ---