Deleted Added
sdiff udiff text old ( 6227:a17798f2a52c ) new ( 6977:039202aafc0d )
full compact
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 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)
508 : current(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);
550 return (Result)(total + current) / (Result)(curTick + 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;
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
2554 /**
2555 *
2556 */
2557 Temp(const Formula &f)
2558 : node(new FormulaNode(f))
2559 { }
2560
2561 /**

--- 193 unchanged lines hidden ---