statistics.hh (6130:0fb959250892) statistics.hh (6212:64c3b989238c)
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;

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

1266 * Templatized storage and interface for a distrbution stat.
1267 */
1268class DistStor
1269{
1270 public:
1271 /** The parameters for a distribution stat. */
1272 struct Params : public DistParams
1273 {
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;

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

1266 * Templatized storage and interface for a distrbution stat.
1267 */
1268class DistStor
1269{
1270 public:
1271 /** The parameters for a distribution stat. */
1272 struct Params : public DistParams
1273 {
1274 Params() : DistParams(false) {}
1274 Params() : DistParams(Dist) {}
1275 };
1276
1277 private:
1278 /** The minimum value to track. */
1279 Counter min_track;
1280 /** The maximum value to track. */
1281 Counter max_track;
1282 /** The number of entries in each bucket. */

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

1400 samples = Counter();
1401 }
1402};
1403
1404/**
1405 * Templatized storage and interface for a distribution that calculates mean
1406 * and variance.
1407 */
1275 };
1276
1277 private:
1278 /** The minimum value to track. */
1279 Counter min_track;
1280 /** The maximum value to track. */
1281 Counter max_track;
1282 /** The number of entries in each bucket. */

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

1400 samples = Counter();
1401 }
1402};
1403
1404/**
1405 * Templatized storage and interface for a distribution that calculates mean
1406 * and variance.
1407 */
1408class FancyStor
1408class SampleStor
1409{
1410 public:
1411 struct Params : public DistParams
1412 {
1409{
1410 public:
1411 struct Params : public DistParams
1412 {
1413 Params() : DistParams(true) {}
1413 Params() : DistParams(Deviation) {}
1414 };
1415
1416 private:
1417 /** The current sum. */
1418 Counter sum;
1419 /** The sum of squares. */
1420 Counter squares;
1421 /** The number of samples. */
1422 Counter samples;
1423
1424 public:
1425 /**
1426 * Create and initialize this storage.
1427 */
1414 };
1415
1416 private:
1417 /** The current sum. */
1418 Counter sum;
1419 /** The sum of squares. */
1420 Counter squares;
1421 /** The number of samples. */
1422 Counter samples;
1423
1424 public:
1425 /**
1426 * Create and initialize this storage.
1427 */
1428 FancyStor(Info *info)
1428 SampleStor(Info *info)
1429 : sum(Counter()), squares(Counter()), samples(Counter())
1430 { }
1431
1432 /**
1433 * Add a value the given number of times to this running average.
1434 * Update the running sum and sum of squares, increment the number of
1435 * values seen by the given number.
1436 * @param val The value to add.

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

1476 samples = Counter();
1477 }
1478};
1479
1480/**
1481 * Templatized storage for distribution that calculates per tick mean and
1482 * variance.
1483 */
1429 : sum(Counter()), squares(Counter()), samples(Counter())
1430 { }
1431
1432 /**
1433 * Add a value the given number of times to this running average.
1434 * Update the running sum and sum of squares, increment the number of
1435 * values seen by the given number.
1436 * @param val The value to add.

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

1476 samples = Counter();
1477 }
1478};
1479
1480/**
1481 * Templatized storage for distribution that calculates per tick mean and
1482 * variance.
1483 */
1484class AvgFancy
1484class AvgSampleStor
1485{
1486 public:
1487 struct Params : public DistParams
1488 {
1485{
1486 public:
1487 struct Params : public DistParams
1488 {
1489 Params() : DistParams(true) {}
1489 Params() : DistParams(Deviation) {}
1490 };
1491
1492 private:
1493 /** Current total. */
1494 Counter sum;
1495 /** Current sum of squares. */
1496 Counter squares;
1497
1498 public:
1499 /**
1500 * Create and initialize this storage.
1501 */
1490 };
1491
1492 private:
1493 /** Current total. */
1494 Counter sum;
1495 /** Current sum of squares. */
1496 Counter squares;
1497
1498 public:
1499 /**
1500 * Create and initialize this storage.
1501 */
1502 AvgFancy(Info *info)
1502 AvgSampleStor(Info *info)
1503 : sum(Counter()), squares(Counter())
1504 {}
1505
1506 /**
1507 * Add a value to the distribution for the given number of times.
1508 * Update the running sum and sum of squares.
1509 * @param val The value to add.
1510 * @param number The number of times to add the value.

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

2268 this->setParams(params);
2269 this->doInit();
2270 return this->self();
2271 }
2272};
2273
2274/**
2275 * Calculates the mean and variance of all the samples.
1503 : sum(Counter()), squares(Counter())
1504 {}
1505
1506 /**
1507 * Add a value to the distribution for the given number of times.
1508 * Update the running sum and sum of squares.
1509 * @param val The value to add.
1510 * @param number The number of times to add the value.

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

2268 this->setParams(params);
2269 this->doInit();
2270 return this->self();
2271 }
2272};
2273
2274/**
2275 * Calculates the mean and variance of all the samples.
2276 * @sa Stat, DistBase, FancyStor
2276 * @sa DistBase, SampleStor
2277 */
2277 */
2278class StandardDeviation : public DistBase<StandardDeviation, FancyStor>
2278class StandardDeviation : public DistBase<StandardDeviation, SampleStor>
2279{
2280 public:
2281 /**
2282 * Construct and initialize this distribution.
2283 */
2284 StandardDeviation()
2285 {
2286 this->doInit();
2287 }
2288};
2289
2290/**
2291 * Calculates the per tick mean and variance of the samples.
2279{
2280 public:
2281 /**
2282 * Construct and initialize this distribution.
2283 */
2284 StandardDeviation()
2285 {
2286 this->doInit();
2287 }
2288};
2289
2290/**
2291 * Calculates the per tick mean and variance of the samples.
2292 * @sa Stat, DistBase, AvgFancy
2292 * @sa DistBase, AvgSampleStor
2293 */
2293 */
2294class AverageDeviation : public DistBase<AverageDeviation, AvgFancy>
2294class AverageDeviation : public DistBase<AverageDeviation, AvgSampleStor>
2295{
2296 public:
2297 /**
2298 * Construct and initialize this distribution.
2299 */
2300 AverageDeviation()
2301 {
2302 this->doInit();
2303 }
2304};
2305
2306/**
2307 * A vector of distributions.
2295{
2296 public:
2297 /**
2298 * Construct and initialize this distribution.
2299 */
2300 AverageDeviation()
2301 {
2302 this->doInit();
2303 }
2304};
2305
2306/**
2307 * A vector of distributions.
2308 * @sa Stat, VectorDistBase, DistStor
2308 * @sa VectorDistBase, DistStor
2309 */
2310class VectorDistribution : public VectorDistBase<VectorDistribution, DistStor>
2311{
2312 public:
2313 /**
2314 * Initialize storage and parameters for this distribution.
2315 * @param size The size of the vector (the number of distributions).
2316 * @param min The minimum value of the distribution.

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

2329 this->setParams(params);
2330 this->doInit(size);
2331 return this->self();
2332 }
2333};
2334
2335/**
2336 * This is a vector of StandardDeviation stats.
2309 */
2310class VectorDistribution : public VectorDistBase<VectorDistribution, DistStor>
2311{
2312 public:
2313 /**
2314 * Initialize storage and parameters for this distribution.
2315 * @param size The size of the vector (the number of distributions).
2316 * @param min The minimum value of the distribution.

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

2329 this->setParams(params);
2330 this->doInit(size);
2331 return this->self();
2332 }
2333};
2334
2335/**
2336 * This is a vector of StandardDeviation stats.
2337 * @sa Stat, VectorDistBase, FancyStor
2337 * @sa VectorDistBase, SampleStor
2338 */
2339class VectorStandardDeviation
2338 */
2339class VectorStandardDeviation
2340 : public VectorDistBase<VectorStandardDeviation, FancyStor>
2340 : public VectorDistBase<VectorStandardDeviation, SampleStor>
2341{
2342 public:
2343 /**
2344 * Initialize storage for this distribution.
2345 * @param size The size of the vector.
2346 * @return A reference to this distribution.
2347 */
2348 VectorStandardDeviation &
2349 init(size_type size)
2350 {
2351 this->doInit(size);
2352 return this->self();
2353 }
2354};
2355
2356/**
2357 * This is a vector of AverageDeviation stats.
2341{
2342 public:
2343 /**
2344 * Initialize storage for this distribution.
2345 * @param size The size of the vector.
2346 * @return A reference to this distribution.
2347 */
2348 VectorStandardDeviation &
2349 init(size_type size)
2350 {
2351 this->doInit(size);
2352 return this->self();
2353 }
2354};
2355
2356/**
2357 * This is a vector of AverageDeviation stats.
2358 * @sa Stat, VectorDistBase, AvgFancy
2358 * @sa VectorDistBase, AvgSampleStor
2359 */
2360class VectorAverageDeviation
2359 */
2360class VectorAverageDeviation
2361 : public VectorDistBase<VectorAverageDeviation, AvgFancy>
2361 : public VectorDistBase<VectorAverageDeviation, AvgSampleStor>
2362{
2363 public:
2364 /**
2365 * Initialize storage for this distribution.
2366 * @param size The size of the vector.
2367 * @return A reference to this distribution.
2368 */
2369 VectorAverageDeviation &

--- 385 unchanged lines hidden ---
2362{
2363 public:
2364 /**
2365 * Initialize storage for this distribution.
2366 * @param size The size of the vector.
2367 * @return A reference to this distribution.
2368 */
2369 VectorAverageDeviation &

--- 385 unchanged lines hidden ---