statistics.hh (8514:57c96df312a1) | statistics.hh (8666:97d873b8b13e) |
---|---|
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; --- 1463 unchanged lines hidden (view full) --- 1472 Counter min_bucket; 1473 /** The maximum value to track. */ 1474 Counter max_bucket; 1475 /** The number of entries in each bucket. */ 1476 Counter bucket_size; 1477 1478 /** The current sum. */ 1479 Counter sum; | 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; --- 1463 unchanged lines hidden (view full) --- 1472 Counter min_bucket; 1473 /** The maximum value to track. */ 1474 Counter max_bucket; 1475 /** The number of entries in each bucket. */ 1476 Counter bucket_size; 1477 1478 /** The current sum. */ 1479 Counter sum; |
1480 /** The sum of logarithm of each sample, used to compute geometric mean. */ 1481 Counter logs; |
|
1480 /** The sum of squares. */ 1481 Counter squares; 1482 /** The number of samples. */ 1483 Counter samples; 1484 /** Counter for each bucket. */ 1485 VCounter cvec; 1486 1487 public: --- 35 unchanged lines hidden (view full) --- 1523 size_type index = 1524 (int64_t)std::floor((val - min_bucket) / bucket_size); 1525 1526 assert(index >= 0 && index < size()); 1527 cvec[index] += number; 1528 1529 sum += val * number; 1530 squares += val * val * number; | 1482 /** The sum of squares. */ 1483 Counter squares; 1484 /** The number of samples. */ 1485 Counter samples; 1486 /** Counter for each bucket. */ 1487 VCounter cvec; 1488 1489 public: --- 35 unchanged lines hidden (view full) --- 1525 size_type index = 1526 (int64_t)std::floor((val - min_bucket) / bucket_size); 1527 1528 assert(index >= 0 && index < size()); 1529 cvec[index] += number; 1530 1531 sum += val * number; 1532 squares += val * val * number; |
1533 logs += log(val) * number; |
|
1531 samples += number; 1532 } 1533 1534 /** 1535 * Return the number of buckets in this distribution. 1536 * @return the number of buckets. 1537 */ 1538 size_type size() const { return cvec.size(); } --- 23 unchanged lines hidden (view full) --- 1562 data.max_val = max_bucket; 1563 1564 int buckets = params->buckets; 1565 data.cvec.resize(buckets); 1566 for (off_type i = 0; i < buckets; ++i) 1567 data.cvec[i] = cvec[i]; 1568 1569 data.sum = sum; | 1534 samples += number; 1535 } 1536 1537 /** 1538 * Return the number of buckets in this distribution. 1539 * @return the number of buckets. 1540 */ 1541 size_type size() const { return cvec.size(); } --- 23 unchanged lines hidden (view full) --- 1565 data.max_val = max_bucket; 1566 1567 int buckets = params->buckets; 1568 data.cvec.resize(buckets); 1569 for (off_type i = 0; i < buckets; ++i) 1570 data.cvec[i] = cvec[i]; 1571 1572 data.sum = sum; |
1573 data.logs = logs; |
|
1570 data.squares = squares; 1571 data.samples = samples; 1572 } 1573 1574 /** 1575 * Reset stat value to default 1576 */ 1577 void --- 6 unchanged lines hidden (view full) --- 1584 1585 size_type size = cvec.size(); 1586 for (off_type i = 0; i < size; ++i) 1587 cvec[i] = Counter(); 1588 1589 sum = Counter(); 1590 squares = Counter(); 1591 samples = Counter(); | 1574 data.squares = squares; 1575 data.samples = samples; 1576 } 1577 1578 /** 1579 * Reset stat value to default 1580 */ 1581 void --- 6 unchanged lines hidden (view full) --- 1588 1589 size_type size = cvec.size(); 1590 for (off_type i = 0; i < size; ++i) 1591 cvec[i] = Counter(); 1592 1593 sum = Counter(); 1594 squares = Counter(); 1595 samples = Counter(); |
1596 logs = Counter(); |
|
1592 } 1593}; 1594 1595/** 1596 * Templatized storage and interface for a distribution that calculates mean 1597 * and variance. 1598 */ 1599class SampleStor --- 1536 unchanged lines hidden --- | 1597 } 1598}; 1599 1600/** 1601 * Templatized storage and interface for a distribution that calculates mean 1602 * and variance. 1603 */ 1604class SampleStor --- 1536 unchanged lines hidden --- |