statistics.hh (14175:8cf7610e44f8) | statistics.hh (14205:197360deaa20) |
---|---|
1/* | 1/* |
2 * Copyright (c) 2019 Arm Limited 3 * All rights reserved. 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software 9 * licensed hereunder. You may use the software subject to the license 10 * terms below provided that you ensure that this notice is replicated 11 * unmodified and in its entirety in all distributions of the software, 12 * modified or unmodified, in source code or in binary form. 13 * |
|
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * Copyright (c) 2017, Centre National de la Recherche Scientifique 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer; --- 48 unchanged lines hidden (view full) --- 58#include <functional> 59#include <iosfwd> 60#include <list> 61#include <map> 62#include <memory> 63#include <string> 64#include <vector> 65 | 14 * Copyright (c) 2003-2005 The Regents of The University of Michigan 15 * Copyright (c) 2017, Centre National de la Recherche Scientifique 16 * All rights reserved. 17 * 18 * Redistribution and use in source and binary forms, with or without 19 * modification, are permitted provided that the following conditions are 20 * met: redistributions of source code must retain the above copyright 21 * notice, this list of conditions and the following disclaimer; --- 48 unchanged lines hidden (view full) --- 70#include <functional> 71#include <iosfwd> 72#include <list> 73#include <map> 74#include <memory> 75#include <string> 76#include <vector> 77 |
78#include "base/stats/group.hh" |
|
66#include "base/stats/info.hh" 67#include "base/stats/output.hh" 68#include "base/stats/types.hh" 69#include "base/cast.hh" 70#include "base/cprintf.hh" 71#include "base/intmath.hh" 72#include "base/str.hh" 73#include "base/types.hh" --- 93 unchanged lines hidden (view full) --- 167 168struct StorageParams 169{ 170 virtual ~StorageParams(); 171}; 172 173class InfoAccess 174{ | 79#include "base/stats/info.hh" 80#include "base/stats/output.hh" 81#include "base/stats/types.hh" 82#include "base/cast.hh" 83#include "base/cprintf.hh" 84#include "base/intmath.hh" 85#include "base/str.hh" 86#include "base/types.hh" --- 93 unchanged lines hidden (view full) --- 180 181struct StorageParams 182{ 183 virtual ~StorageParams(); 184}; 185 186class InfoAccess 187{ |
188 private: 189 Info *_info; 190 |
|
175 protected: 176 /** Set up an info class for this statistic */ | 191 protected: 192 /** Set up an info class for this statistic */ |
177 void setInfo(Info *info); | 193 void setInfo(Group *parent, Info *info); |
178 /** Save Storage class parameters if any */ 179 void setParams(const StorageParams *params); 180 /** Save Storage class parameters if any */ 181 void setInit(); 182 183 /** Grab the information class for this statistic */ 184 Info *info(); 185 /** Grab the information class for this statistic */ 186 const Info *info() const; 187 188 public: | 194 /** Save Storage class parameters if any */ 195 void setParams(const StorageParams *params); 196 /** Save Storage class parameters if any */ 197 void setInit(); 198 199 /** Grab the information class for this statistic */ 200 Info *info(); 201 /** Grab the information class for this statistic */ 202 const Info *info() const; 203 204 public: |
205 InfoAccess() 206 : _info(nullptr) {}; 207 |
|
189 /** 190 * Reset the stat to the default state. 191 */ 192 void reset() { } 193 194 /** 195 * @return true if this stat has a value and satisfies its 196 * requirement as a prereq --- 26 unchanged lines hidden (view full) --- 223 224 public: 225 const Info * 226 info() const 227 { 228 return safe_cast<const Info *>(InfoAccess::info()); 229 } 230 | 208 /** 209 * Reset the stat to the default state. 210 */ 211 void reset() { } 212 213 /** 214 * @return true if this stat has a value and satisfies its 215 * requirement as a prereq --- 26 unchanged lines hidden (view full) --- 242 243 public: 244 const Info * 245 info() const 246 { 247 return safe_cast<const Info *>(InfoAccess::info()); 248 } 249 |
231 protected: 232 /** 233 * Copy constructor, copies are not allowed. 234 */ 235 DataWrap(const DataWrap &stat) = delete; | 250 public: 251 DataWrap() = delete; 252 DataWrap(const DataWrap &) = delete; 253 DataWrap &operator=(const DataWrap &) = delete; |
236 | 254 |
237 /** 238 * Can't copy stats. 239 */ 240 void operator=(const DataWrap &) {} | |
241 | 255 |
242 public: 243 DataWrap() | 256 DataWrap(Group *parent, const char *name, const char *desc) |
244 { | 257 { |
245 this->setInfo(new Info(self())); | 258 auto info = new Info(self()); 259 this->setInfo(parent, info); 260 261 if (parent) 262 parent->addStat(info); 263 264 if (name) { 265 info->setName(name); 266 info->flags.set(display); 267 } 268 269 if (desc) 270 info->desc = desc; |
246 } 247 248 /** 249 * Set the name and marks this stat to print at the end of simulation. 250 * @param name The new name. 251 * @return A reference to this stat. 252 */ 253 Derived & --- 76 unchanged lines hidden (view full) --- 330}; 331 332template <class Derived, template <class> class InfoProxyType> 333class DataWrapVec : public DataWrap<Derived, InfoProxyType> 334{ 335 public: 336 typedef InfoProxyType<Derived> Info; 337 | 271 } 272 273 /** 274 * Set the name and marks this stat to print at the end of simulation. 275 * @param name The new name. 276 * @return A reference to this stat. 277 */ 278 Derived & --- 76 unchanged lines hidden (view full) --- 355}; 356 357template <class Derived, template <class> class InfoProxyType> 358class DataWrapVec : public DataWrap<Derived, InfoProxyType> 359{ 360 public: 361 typedef InfoProxyType<Derived> Info; 362 |
338 DataWrapVec() | 363 DataWrapVec(Group *parent = nullptr, const char *name = nullptr, 364 const char *desc = nullptr) 365 : DataWrap<Derived, InfoProxyType>(parent, name, desc) |
339 {} 340 | 366 {} 367 |
341 DataWrapVec(const DataWrapVec &ref) 342 {} 343 344 void operator=(const DataWrapVec &) 345 {} 346 | |
347 // The following functions are specific to vectors. If you use them 348 // in a non vector context, you will get a nice compiler error! 349 350 /** 351 * Set the subfield name for the given index, and marks this stat to print 352 * at the end of simulation. 353 * @param index The subfield index. 354 * @param name The new name of the subfield. --- 60 unchanged lines hidden (view full) --- 415}; 416 417template <class Derived, template <class> class InfoProxyType> 418class DataWrapVec2d : public DataWrapVec<Derived, InfoProxyType> 419{ 420 public: 421 typedef InfoProxyType<Derived> Info; 422 | 368 // The following functions are specific to vectors. If you use them 369 // in a non vector context, you will get a nice compiler error! 370 371 /** 372 * Set the subfield name for the given index, and marks this stat to print 373 * at the end of simulation. 374 * @param index The subfield index. 375 * @param name The new name of the subfield. --- 60 unchanged lines hidden (view full) --- 436}; 437 438template <class Derived, template <class> class InfoProxyType> 439class DataWrapVec2d : public DataWrapVec<Derived, InfoProxyType> 440{ 441 public: 442 typedef InfoProxyType<Derived> Info; 443 |
444 DataWrapVec2d(Group *parent, const char *name, const char *desc) 445 : DataWrapVec<Derived, InfoProxyType>(parent, name, desc) 446 { 447 } 448 |
|
423 /** 424 * @warning This makes the assumption that if you're gonna subnames a 2d 425 * vector, you're subnaming across all y 426 */ 427 Derived & 428 ysubnames(const char **names) 429 { 430 Derived &self = this->self(); --- 241 unchanged lines hidden (view full) --- 672 public: 673 /** 674 * Return the current value of this stat as its base type. 675 * @return The current value. 676 */ 677 Counter value() const { return data()->value(); } 678 679 public: | 449 /** 450 * @warning This makes the assumption that if you're gonna subnames a 2d 451 * vector, you're subnaming across all y 452 */ 453 Derived & 454 ysubnames(const char **names) 455 { 456 Derived &self = this->self(); --- 241 unchanged lines hidden (view full) --- 698 public: 699 /** 700 * Return the current value of this stat as its base type. 701 * @return The current value. 702 */ 703 Counter value() const { return data()->value(); } 704 705 public: |
680 ScalarBase() | 706 ScalarBase(Group *parent = nullptr, const char *name = nullptr, 707 const char *desc = nullptr) 708 : DataWrap<Derived, ScalarInfoProxy>(parent, name, desc) |
681 { 682 this->doInit(); 683 } 684 685 public: 686 // Common operators for stats 687 /** 688 * Increment the stat by 1. This calls the associated storage object inc --- 113 unchanged lines hidden (view full) --- 802 803template <class Derived> 804class ValueBase : public DataWrap<Derived, ScalarInfoProxy> 805{ 806 private: 807 ProxyInfo *proxy; 808 809 public: | 709 { 710 this->doInit(); 711 } 712 713 public: 714 // Common operators for stats 715 /** 716 * Increment the stat by 1. This calls the associated storage object inc --- 113 unchanged lines hidden (view full) --- 830 831template <class Derived> 832class ValueBase : public DataWrap<Derived, ScalarInfoProxy> 833{ 834 private: 835 ProxyInfo *proxy; 836 837 public: |
810 ValueBase() : proxy(NULL) { } | 838 ValueBase(Group *parent, const char *name, const char *desc) 839 : DataWrap<Derived, ScalarInfoProxy>(parent, name, desc), 840 proxy(NULL) 841 { 842 } 843 |
811 ~ValueBase() { if (proxy) delete proxy; } 812 813 template <class T> 814 Derived & 815 scalar(T &value) 816 { 817 proxy = new ValueProxy<T>(value); 818 this->setInit(); --- 271 unchanged lines hidden (view full) --- 1090 1091 bool 1092 check() const 1093 { 1094 return storage != NULL; 1095 } 1096 1097 public: | 844 ~ValueBase() { if (proxy) delete proxy; } 845 846 template <class T> 847 Derived & 848 scalar(T &value) 849 { 850 proxy = new ValueProxy<T>(value); 851 this->setInit(); --- 271 unchanged lines hidden (view full) --- 1123 1124 bool 1125 check() const 1126 { 1127 return storage != NULL; 1128 } 1129 1130 public: |
1098 VectorBase() 1099 : storage(nullptr), _size(0) | 1131 VectorBase(Group *parent, const char *name, const char *desc) 1132 : DataWrapVec<Derived, VectorInfoProxy>(parent, name, desc), 1133 storage(nullptr), _size(0) |
1100 {} 1101 1102 ~VectorBase() 1103 { 1104 if (!storage) 1105 return; 1106 1107 for (off_type i = 0; i < _size; ++i) --- 122 unchanged lines hidden (view full) --- 1230 size_type _size; 1231 Storage *storage; 1232 1233 protected: 1234 Storage *data(off_type index) { return &storage[index]; } 1235 const Storage *data(off_type index) const { return &storage[index]; } 1236 1237 public: | 1134 {} 1135 1136 ~VectorBase() 1137 { 1138 if (!storage) 1139 return; 1140 1141 for (off_type i = 0; i < _size; ++i) --- 122 unchanged lines hidden (view full) --- 1264 size_type _size; 1265 Storage *storage; 1266 1267 protected: 1268 Storage *data(off_type index) { return &storage[index]; } 1269 const Storage *data(off_type index) const { return &storage[index]; } 1270 1271 public: |
1238 Vector2dBase() 1239 : x(0), y(0), _size(0), storage(nullptr) | 1272 Vector2dBase(Group *parent, const char *name, const char *desc) 1273 : DataWrapVec2d<Derived, Vector2dInfoProxy>(parent, name, desc), 1274 x(0), y(0), _size(0), storage(nullptr) |
1240 {} 1241 1242 ~Vector2dBase() 1243 { 1244 if (!storage) 1245 return; 1246 1247 for (off_type i = 0; i < _size; ++i) --- 598 unchanged lines hidden (view full) --- 1846 void 1847 doInit() 1848 { 1849 new (storage) Storage(this->info()); 1850 this->setInit(); 1851 } 1852 1853 public: | 1275 {} 1276 1277 ~Vector2dBase() 1278 { 1279 if (!storage) 1280 return; 1281 1282 for (off_type i = 0; i < _size; ++i) --- 598 unchanged lines hidden (view full) --- 1881 void 1882 doInit() 1883 { 1884 new (storage) Storage(this->info()); 1885 this->setInit(); 1886 } 1887 1888 public: |
1854 DistBase() { } | 1889 DistBase(Group *parent, const char *name, const char *desc) 1890 : DataWrap<Derived, DistInfoProxy>(parent, name, desc) 1891 { 1892 } |
1855 1856 /** 1857 * Add a value to the distribtion n times. Calls sample on the storage 1858 * class. 1859 * @param v The value to add. 1860 * @param n The number of times to add it, defaults to 1. 1861 */ 1862 template <typename U> --- 77 unchanged lines hidden (view full) --- 1940 Info *info = this->info(); 1941 for (off_type i = 0; i < _size; ++i) 1942 new (&storage[i]) Storage(info); 1943 1944 this->setInit(); 1945 } 1946 1947 public: | 1893 1894 /** 1895 * Add a value to the distribtion n times. Calls sample on the storage 1896 * class. 1897 * @param v The value to add. 1898 * @param n The number of times to add it, defaults to 1. 1899 */ 1900 template <typename U> --- 77 unchanged lines hidden (view full) --- 1978 Info *info = this->info(); 1979 for (off_type i = 0; i < _size; ++i) 1980 new (&storage[i]) Storage(info); 1981 1982 this->setInit(); 1983 } 1984 1985 public: |
1948 VectorDistBase() 1949 : storage(NULL) | 1986 VectorDistBase(Group *parent, const char *name, const char *desc) 1987 : DataWrapVec<Derived, VectorDistInfoProxy>(parent, name, desc), 1988 storage(NULL) |
1950 {} 1951 1952 ~VectorDistBase() 1953 { 1954 if (!storage) 1955 return ; 1956 1957 for (off_type i = 0; i < _size; ++i) --- 509 unchanged lines hidden (view full) --- 2467/** 2468 * This is a simple scalar statistic, like a counter. 2469 * @sa Stat, ScalarBase, StatStor 2470 */ 2471class Scalar : public ScalarBase<Scalar, StatStor> 2472{ 2473 public: 2474 using ScalarBase<Scalar, StatStor>::operator=; | 1989 {} 1990 1991 ~VectorDistBase() 1992 { 1993 if (!storage) 1994 return ; 1995 1996 for (off_type i = 0; i < _size; ++i) --- 509 unchanged lines hidden (view full) --- 2506/** 2507 * This is a simple scalar statistic, like a counter. 2508 * @sa Stat, ScalarBase, StatStor 2509 */ 2510class Scalar : public ScalarBase<Scalar, StatStor> 2511{ 2512 public: 2513 using ScalarBase<Scalar, StatStor>::operator=; |
2514 2515 Scalar(Group *parent = nullptr, const char *name = nullptr, 2516 const char *desc = nullptr) 2517 : ScalarBase<Scalar, StatStor>(parent, name, desc) 2518 { 2519 } |
|
2475}; 2476 2477/** 2478 * A stat that calculates the per tick average of a value. 2479 * @sa Stat, ScalarBase, AvgStor 2480 */ 2481class Average : public ScalarBase<Average, AvgStor> 2482{ 2483 public: 2484 using ScalarBase<Average, AvgStor>::operator=; | 2520}; 2521 2522/** 2523 * A stat that calculates the per tick average of a value. 2524 * @sa Stat, ScalarBase, AvgStor 2525 */ 2526class Average : public ScalarBase<Average, AvgStor> 2527{ 2528 public: 2529 using ScalarBase<Average, AvgStor>::operator=; |
2530 2531 Average(Group *parent = nullptr, const char *name = nullptr, 2532 const char *desc = nullptr) 2533 : ScalarBase<Average, AvgStor>(parent, name, desc) 2534 { 2535 } |
|
2485}; 2486 2487class Value : public ValueBase<Value> 2488{ | 2536}; 2537 2538class Value : public ValueBase<Value> 2539{ |
2540 public: 2541 Value(Group *parent = nullptr, const char *name = nullptr, 2542 const char *desc = nullptr) 2543 : ValueBase<Value>(parent, name, desc) 2544 { 2545 } |
|
2489}; 2490 2491/** 2492 * A vector of scalar stats. 2493 * @sa Stat, VectorBase, StatStor 2494 */ 2495class Vector : public VectorBase<Vector, StatStor> 2496{ | 2546}; 2547 2548/** 2549 * A vector of scalar stats. 2550 * @sa Stat, VectorBase, StatStor 2551 */ 2552class Vector : public VectorBase<Vector, StatStor> 2553{ |
2554 public: 2555 Vector(Group *parent = nullptr, const char *name = nullptr, 2556 const char *desc = nullptr) 2557 : VectorBase<Vector, StatStor>(parent, name, desc) 2558 { 2559 } |
|
2497}; 2498 2499/** 2500 * A vector of Average stats. 2501 * @sa Stat, VectorBase, AvgStor 2502 */ 2503class AverageVector : public VectorBase<AverageVector, AvgStor> 2504{ | 2560}; 2561 2562/** 2563 * A vector of Average stats. 2564 * @sa Stat, VectorBase, AvgStor 2565 */ 2566class AverageVector : public VectorBase<AverageVector, AvgStor> 2567{ |
2568 public: 2569 AverageVector(Group *parent = nullptr, const char *name = nullptr, 2570 const char *desc = nullptr) 2571 : VectorBase<AverageVector, AvgStor>(parent, name, desc) 2572 { 2573 } |
|
2505}; 2506 2507/** 2508 * A 2-Dimensional vecto of scalar stats. 2509 * @sa Stat, Vector2dBase, StatStor 2510 */ 2511class Vector2d : public Vector2dBase<Vector2d, StatStor> 2512{ | 2574}; 2575 2576/** 2577 * A 2-Dimensional vecto of scalar stats. 2578 * @sa Stat, Vector2dBase, StatStor 2579 */ 2580class Vector2d : public Vector2dBase<Vector2d, StatStor> 2581{ |
2582 public: 2583 Vector2d(Group *parent = nullptr, const char *name = nullptr, 2584 const char *desc = nullptr) 2585 : Vector2dBase<Vector2d, StatStor>(parent, name, desc) 2586 { 2587 } |
|
2513}; 2514 2515/** 2516 * A simple distribution stat. 2517 * @sa Stat, DistBase, DistStor 2518 */ 2519class Distribution : public DistBase<Distribution, DistStor> 2520{ 2521 public: | 2588}; 2589 2590/** 2591 * A simple distribution stat. 2592 * @sa Stat, DistBase, DistStor 2593 */ 2594class Distribution : public DistBase<Distribution, DistStor> 2595{ 2596 public: |
2597 Distribution(Group *parent = nullptr, const char *name = nullptr, 2598 const char *desc = nullptr) 2599 : DistBase<Distribution, DistStor>(parent, name, desc) 2600 { 2601 } 2602 |
|
2522 /** 2523 * Set the parameters of this distribution. @sa DistStor::Params 2524 * @param min The minimum value of the distribution. 2525 * @param max The maximum value of the distribution. 2526 * @param bkt The number of values in each bucket. 2527 * @return A reference to this distribution. 2528 */ 2529 Distribution & --- 15 unchanged lines hidden (view full) --- 2545 2546/** 2547 * A simple histogram stat. 2548 * @sa Stat, DistBase, HistStor 2549 */ 2550class Histogram : public DistBase<Histogram, HistStor> 2551{ 2552 public: | 2603 /** 2604 * Set the parameters of this distribution. @sa DistStor::Params 2605 * @param min The minimum value of the distribution. 2606 * @param max The maximum value of the distribution. 2607 * @param bkt The number of values in each bucket. 2608 * @return A reference to this distribution. 2609 */ 2610 Distribution & --- 15 unchanged lines hidden (view full) --- 2626 2627/** 2628 * A simple histogram stat. 2629 * @sa Stat, DistBase, HistStor 2630 */ 2631class Histogram : public DistBase<Histogram, HistStor> 2632{ 2633 public: |
2634 Histogram(Group *parent = nullptr, const char *name = nullptr, 2635 const char *desc = nullptr) 2636 : DistBase<Histogram, HistStor>(parent, name, desc) 2637 { 2638 } 2639 |
|
2553 /** 2554 * Set the parameters of this histogram. @sa HistStor::Params 2555 * @param size The number of buckets in the histogram 2556 * @return A reference to this histogram. 2557 */ 2558 Histogram & 2559 init(size_type size) 2560 { --- 10 unchanged lines hidden (view full) --- 2571 * @sa DistBase, SampleStor 2572 */ 2573class StandardDeviation : public DistBase<StandardDeviation, SampleStor> 2574{ 2575 public: 2576 /** 2577 * Construct and initialize this distribution. 2578 */ | 2640 /** 2641 * Set the parameters of this histogram. @sa HistStor::Params 2642 * @param size The number of buckets in the histogram 2643 * @return A reference to this histogram. 2644 */ 2645 Histogram & 2646 init(size_type size) 2647 { --- 10 unchanged lines hidden (view full) --- 2658 * @sa DistBase, SampleStor 2659 */ 2660class StandardDeviation : public DistBase<StandardDeviation, SampleStor> 2661{ 2662 public: 2663 /** 2664 * Construct and initialize this distribution. 2665 */ |
2579 StandardDeviation() | 2666 StandardDeviation(Group *parent = nullptr, const char *name = nullptr, 2667 const char *desc = nullptr) 2668 : DistBase<StandardDeviation, SampleStor>(parent, name, desc) |
2580 { 2581 SampleStor::Params *params = new SampleStor::Params; 2582 this->doInit(); 2583 this->setParams(params); 2584 } 2585}; 2586 2587/** 2588 * Calculates the per tick mean and variance of the samples. 2589 * @sa DistBase, AvgSampleStor 2590 */ 2591class AverageDeviation : public DistBase<AverageDeviation, AvgSampleStor> 2592{ 2593 public: 2594 /** 2595 * Construct and initialize this distribution. 2596 */ | 2669 { 2670 SampleStor::Params *params = new SampleStor::Params; 2671 this->doInit(); 2672 this->setParams(params); 2673 } 2674}; 2675 2676/** 2677 * Calculates the per tick mean and variance of the samples. 2678 * @sa DistBase, AvgSampleStor 2679 */ 2680class AverageDeviation : public DistBase<AverageDeviation, AvgSampleStor> 2681{ 2682 public: 2683 /** 2684 * Construct and initialize this distribution. 2685 */ |
2597 AverageDeviation() | 2686 AverageDeviation(Group *parent = nullptr, const char *name = nullptr, 2687 const char *desc = nullptr) 2688 : DistBase<AverageDeviation, AvgSampleStor>(parent, name, desc) |
2598 { 2599 AvgSampleStor::Params *params = new AvgSampleStor::Params; 2600 this->doInit(); 2601 this->setParams(params); 2602 } 2603}; 2604 2605/** 2606 * A vector of distributions. 2607 * @sa VectorDistBase, DistStor 2608 */ 2609class VectorDistribution : public VectorDistBase<VectorDistribution, DistStor> 2610{ 2611 public: | 2689 { 2690 AvgSampleStor::Params *params = new AvgSampleStor::Params; 2691 this->doInit(); 2692 this->setParams(params); 2693 } 2694}; 2695 2696/** 2697 * A vector of distributions. 2698 * @sa VectorDistBase, DistStor 2699 */ 2700class VectorDistribution : public VectorDistBase<VectorDistribution, DistStor> 2701{ 2702 public: |
2703 VectorDistribution(Group *parent = nullptr, const char *name = nullptr, 2704 const char *desc = nullptr) 2705 : VectorDistBase<VectorDistribution, DistStor>(parent, name, desc) 2706 { 2707 } 2708 |
|
2612 /** 2613 * Initialize storage and parameters for this distribution. 2614 * @param size The size of the vector (the number of distributions). 2615 * @param min The minimum value of the distribution. 2616 * @param max The maximum value of the distribution. 2617 * @param bkt The number of values in each bucket. 2618 * @return A reference to this distribution. 2619 */ --- 14 unchanged lines hidden (view full) --- 2634/** 2635 * This is a vector of StandardDeviation stats. 2636 * @sa VectorDistBase, SampleStor 2637 */ 2638class VectorStandardDeviation 2639 : public VectorDistBase<VectorStandardDeviation, SampleStor> 2640{ 2641 public: | 2709 /** 2710 * Initialize storage and parameters for this distribution. 2711 * @param size The size of the vector (the number of distributions). 2712 * @param min The minimum value of the distribution. 2713 * @param max The maximum value of the distribution. 2714 * @param bkt The number of values in each bucket. 2715 * @return A reference to this distribution. 2716 */ --- 14 unchanged lines hidden (view full) --- 2731/** 2732 * This is a vector of StandardDeviation stats. 2733 * @sa VectorDistBase, SampleStor 2734 */ 2735class VectorStandardDeviation 2736 : public VectorDistBase<VectorStandardDeviation, SampleStor> 2737{ 2738 public: |
2739 VectorStandardDeviation(Group *parent = nullptr, const char *name = nullptr, 2740 const char *desc = nullptr) 2741 : VectorDistBase<VectorStandardDeviation, SampleStor>(parent, name, 2742 desc) 2743 { 2744 } 2745 |
|
2642 /** 2643 * Initialize storage for this distribution. 2644 * @param size The size of the vector. 2645 * @return A reference to this distribution. 2646 */ 2647 VectorStandardDeviation & 2648 init(size_type size) 2649 { --- 7 unchanged lines hidden (view full) --- 2657/** 2658 * This is a vector of AverageDeviation stats. 2659 * @sa VectorDistBase, AvgSampleStor 2660 */ 2661class VectorAverageDeviation 2662 : public VectorDistBase<VectorAverageDeviation, AvgSampleStor> 2663{ 2664 public: | 2746 /** 2747 * Initialize storage for this distribution. 2748 * @param size The size of the vector. 2749 * @return A reference to this distribution. 2750 */ 2751 VectorStandardDeviation & 2752 init(size_type size) 2753 { --- 7 unchanged lines hidden (view full) --- 2761/** 2762 * This is a vector of AverageDeviation stats. 2763 * @sa VectorDistBase, AvgSampleStor 2764 */ 2765class VectorAverageDeviation 2766 : public VectorDistBase<VectorAverageDeviation, AvgSampleStor> 2767{ 2768 public: |
2769 VectorAverageDeviation(Group *parent = nullptr, const char *name = nullptr, 2770 const char *desc = nullptr) 2771 : VectorDistBase<VectorAverageDeviation, AvgSampleStor>(parent, name, 2772 desc) 2773 { 2774 } 2775 |
|
2665 /** 2666 * Initialize storage for this distribution. 2667 * @param size The size of the vector. 2668 * @return A reference to this distribution. 2669 */ 2670 VectorAverageDeviation & 2671 init(size_type size) 2672 { --- 75 unchanged lines hidden (view full) --- 2748 void 2749 doInit() 2750 { 2751 new (storage) Storage(this->info()); 2752 this->setInit(); 2753 } 2754 2755 public: | 2776 /** 2777 * Initialize storage for this distribution. 2778 * @param size The size of the vector. 2779 * @return A reference to this distribution. 2780 */ 2781 VectorAverageDeviation & 2782 init(size_type size) 2783 { --- 75 unchanged lines hidden (view full) --- 2859 void 2860 doInit() 2861 { 2862 new (storage) Storage(this->info()); 2863 this->setInit(); 2864 } 2865 2866 public: |
2756 SparseHistBase() { } | 2867 SparseHistBase(Group *parent, const char *name, const char *desc) 2868 : DataWrap<Derived, SparseHistInfoProxy>(parent, name, desc) 2869 { 2870 } |
2757 2758 /** 2759 * Add a value to the distribtion n times. Calls sample on the storage 2760 * class. 2761 * @param v The value to add. 2762 * @param n The number of times to add it, defaults to 1. 2763 */ 2764 template <typename U> --- 100 unchanged lines hidden (view full) --- 2865 cmap.clear(); 2866 samples = 0; 2867 } 2868}; 2869 2870class SparseHistogram : public SparseHistBase<SparseHistogram, SparseHistStor> 2871{ 2872 public: | 2871 2872 /** 2873 * Add a value to the distribtion n times. Calls sample on the storage 2874 * class. 2875 * @param v The value to add. 2876 * @param n The number of times to add it, defaults to 1. 2877 */ 2878 template <typename U> --- 100 unchanged lines hidden (view full) --- 2979 cmap.clear(); 2980 samples = 0; 2981 } 2982}; 2983 2984class SparseHistogram : public SparseHistBase<SparseHistogram, SparseHistStor> 2985{ 2986 public: |
2987 SparseHistogram(Group *parent = nullptr, const char *name = nullptr, 2988 const char *desc = nullptr) 2989 : SparseHistBase<SparseHistogram, SparseHistStor>(parent, name, desc) 2990 { 2991 } 2992 |
|
2873 /** 2874 * Set the parameters of this histogram. @sa HistStor::Params 2875 * @param size The number of buckets in the histogram 2876 * @return A reference to this histogram. 2877 */ 2878 SparseHistogram & 2879 init(size_type size) 2880 { --- 16 unchanged lines hidden (view full) --- 2897 /** The root of the tree which represents the Formula */ 2898 NodePtr root; 2899 friend class Temp; 2900 2901 public: 2902 /** 2903 * Create and initialize thie formula, and register it with the database. 2904 */ | 2993 /** 2994 * Set the parameters of this histogram. @sa HistStor::Params 2995 * @param size The number of buckets in the histogram 2996 * @return A reference to this histogram. 2997 */ 2998 SparseHistogram & 2999 init(size_type size) 3000 { --- 16 unchanged lines hidden (view full) --- 3017 /** The root of the tree which represents the Formula */ 3018 NodePtr root; 3019 friend class Temp; 3020 3021 public: 3022 /** 3023 * Create and initialize thie formula, and register it with the database. 3024 */ |
2905 Formula(); | 3025 Formula(Group *parent = nullptr, const char *name = nullptr, 3026 const char *desc = nullptr); |
2906 | 3027 |
2907 /** 2908 * Create a formula with the given root node, register it with the 2909 * database. 2910 * @param r The root of the expression tree. 2911 */ 2912 Formula(Temp r); | 3028 Formula(Group *parent, const char *name, const char *desc, 3029 const Temp &r); |
2913 2914 /** 2915 * Set an unitialized Formula to the given root. 2916 * @param r The root of the expression tree. 2917 * @return a reference to this formula. 2918 */ | 3030 3031 /** 3032 * Set an unitialized Formula to the given root. 3033 * @param r The root of the expression tree. 3034 * @return a reference to this formula. 3035 */ |
2919 const Formula &operator=(Temp r); | 3036 const Formula &operator=(const Temp &r); |
2920 | 3037 |
3038 template<typename T> 3039 const Formula &operator=(const T &v) 3040 { 3041 *this = Temp(v); 3042 return *this; 3043 } 3044 |
|
2921 /** 2922 * Add the given tree to the existing one. 2923 * @param r The root of the expression tree. 2924 * @return a reference to this formula. 2925 */ 2926 const Formula &operator+=(Temp r); 2927 2928 /** --- 351 unchanged lines hidden --- | 3045 /** 3046 * Add the given tree to the existing one. 3047 * @param r The root of the expression tree. 3048 * @return a reference to this formula. 3049 */ 3050 const Formula &operator+=(Temp r); 3051 3052 /** --- 351 unchanged lines hidden --- |