statistics.hh (5598:345ef3bda3d2) | statistics.hh (5599:5bad83cddb8c) |
---|---|
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; --- 159 unchanged lines hidden (view full) --- 168}; 169 170struct VectorData : public StatData 171{ 172 /** Names and descriptions of subfields. */ 173 mutable std::vector<std::string> subnames; 174 mutable std::vector<std::string> subdescs; 175 | 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; --- 159 unchanged lines hidden (view full) --- 168}; 169 170struct VectorData : public StatData 171{ 172 /** Names and descriptions of subfields. */ 173 mutable std::vector<std::string> subnames; 174 mutable std::vector<std::string> subdescs; 175 |
176 virtual size_t size() const = 0; | 176 virtual size_type size() const = 0; |
177 virtual const VCounter &value() const = 0; 178 virtual const VResult &result() const = 0; 179 virtual Result total() const = 0; 180 181 void 182 update() 183 { 184 if (!subnames.empty()) { | 177 virtual const VCounter &value() const = 0; 178 virtual const VResult &result() const = 0; 179 virtual Result total() const = 0; 180 181 void 182 update() 183 { 184 if (!subnames.empty()) { |
185 int s = size(); | 185 size_type s = size(); |
186 if (subnames.size() < s) 187 subnames.resize(s); 188 189 if (subdescs.size() < s) 190 subdescs.resize(s); 191 } 192 } 193}; --- 8 unchanged lines hidden (view full) --- 202 203 public: 204 VectorStatData(Stat &stat) : s(stat) {} 205 206 virtual bool check() const { return s.check(); } 207 virtual bool zero() const { return s.zero(); } 208 virtual void reset() { s.reset(); } 209 | 186 if (subnames.size() < s) 187 subnames.resize(s); 188 189 if (subdescs.size() < s) 190 subdescs.resize(s); 191 } 192 } 193}; --- 8 unchanged lines hidden (view full) --- 202 203 public: 204 VectorStatData(Stat &stat) : s(stat) {} 205 206 virtual bool check() const { return s.check(); } 207 virtual bool zero() const { return s.zero(); } 208 virtual void reset() { s.reset(); } 209 |
210 virtual size_t size() const { return s.size(); } | 210 virtual size_type size() const { return s.size(); } |
211 212 virtual VCounter & 213 value() const 214 { 215 s.value(cvec); 216 return cvec; 217 } 218 --- 24 unchanged lines hidden (view full) --- 243 VCounter cvec; 244 Counter sum; 245 Counter squares; 246 Counter samples; 247 248 Counter min; 249 Counter max; 250 Counter bucket_size; | 211 212 virtual VCounter & 213 value() const 214 { 215 s.value(cvec); 216 return cvec; 217 } 218 --- 24 unchanged lines hidden (view full) --- 243 VCounter cvec; 244 Counter sum; 245 Counter squares; 246 Counter samples; 247 248 Counter min; 249 Counter max; 250 Counter bucket_size; |
251 int size; | 251 size_type size; |
252 bool fancy; 253}; 254 255struct DistData : public StatData 256{ 257 /** Local storage for the entry values, used for printing. */ 258 DistDataData data; 259}; --- 25 unchanged lines hidden (view full) --- 285 286 /** Names and descriptions of subfields. */ 287 mutable std::vector<std::string> subnames; 288 mutable std::vector<std::string> subdescs; 289 290 /** Local storage for the entry values, used for printing. */ 291 mutable VResult rvec; 292 | 252 bool fancy; 253}; 254 255struct DistData : public StatData 256{ 257 /** Local storage for the entry values, used for printing. */ 258 DistDataData data; 259}; --- 25 unchanged lines hidden (view full) --- 285 286 /** Names and descriptions of subfields. */ 287 mutable std::vector<std::string> subnames; 288 mutable std::vector<std::string> subdescs; 289 290 /** Local storage for the entry values, used for printing. */ 291 mutable VResult rvec; 292 |
293 virtual size_t size() const = 0; | 293 virtual size_type size() const = 0; |
294 295 void 296 update() 297 { | 294 295 void 296 update() 297 { |
298 int s = size(); | 298 size_type s = size(); |
299 if (subnames.size() < s) 300 subnames.resize(s); 301 302 if (subdescs.size() < s) 303 subdescs.resize(s); 304 } 305}; 306 307template <class Stat> 308class VectorDistStatData : public VectorDistData 309{ 310 protected: 311 Stat &s; 312 313 public: 314 VectorDistStatData(Stat &stat) : s(stat) {} 315 316 virtual bool check() const { return s.check(); } 317 virtual void reset() { s.reset(); } | 299 if (subnames.size() < s) 300 subnames.resize(s); 301 302 if (subdescs.size() < s) 303 subdescs.resize(s); 304 } 305}; 306 307template <class Stat> 308class VectorDistStatData : public VectorDistData 309{ 310 protected: 311 Stat &s; 312 313 public: 314 VectorDistStatData(Stat &stat) : s(stat) {} 315 316 virtual bool check() const { return s.check(); } 317 virtual void reset() { s.reset(); } |
318 virtual size_t size() const { return s.size(); } | 318 virtual size_type size() const { return s.size(); } |
319 virtual bool zero() const { return s.zero(); } 320 321 virtual void 322 visit(Visit &visitor) 323 { 324 update(); 325 s.update(this); 326 visitor.visit(*this); --- 4 unchanged lines hidden (view full) --- 331{ 332 /** Names and descriptions of subfields. */ 333 std::vector<std::string> subnames; 334 std::vector<std::string> subdescs; 335 std::vector<std::string> y_subnames; 336 337 /** Local storage for the entry values, used for printing. */ 338 mutable VCounter cvec; | 319 virtual bool zero() const { return s.zero(); } 320 321 virtual void 322 visit(Visit &visitor) 323 { 324 update(); 325 s.update(this); 326 visitor.visit(*this); --- 4 unchanged lines hidden (view full) --- 331{ 332 /** Names and descriptions of subfields. */ 333 std::vector<std::string> subnames; 334 std::vector<std::string> subdescs; 335 std::vector<std::string> y_subnames; 336 337 /** Local storage for the entry values, used for printing. */ 338 mutable VCounter cvec; |
339 mutable int x; 340 mutable int y; | 339 mutable size_type x; 340 mutable size_type y; |
341 342 void 343 update() 344 { 345 if (subnames.size() < x) 346 subnames.resize(x); 347 } 348}; --- 152 unchanged lines hidden (view full) --- 501 /** 502 * Set the subfield name for the given index, and marks this stat to print 503 * at the end of simulation. 504 * @param index The subfield index. 505 * @param name The new name of the subfield. 506 * @return A reference to this stat. 507 */ 508 Parent & | 341 342 void 343 update() 344 { 345 if (subnames.size() < x) 346 subnames.resize(x); 347 } 348}; --- 152 unchanged lines hidden (view full) --- 501 /** 502 * Set the subfield name for the given index, and marks this stat to print 503 * at the end of simulation. 504 * @param index The subfield index. 505 * @param name The new name of the subfield. 506 * @return A reference to this stat. 507 */ 508 Parent & |
509 subname(int index, const std::string &name) | 509 subname(off_type index, const std::string &name) |
510 { 511 std::vector<std::string> &subn = this->statData()->subnames; 512 if (subn.size() <= index) 513 subn.resize(index + 1); 514 subn[index] = name; 515 return this->self(); 516 } 517 518 /** 519 * Set the subfield description for the given index and marks this stat to 520 * print at the end of simulation. 521 * @param index The subfield index. 522 * @param desc The new description of the subfield 523 * @return A reference to this stat. 524 */ 525 Parent & | 510 { 511 std::vector<std::string> &subn = this->statData()->subnames; 512 if (subn.size() <= index) 513 subn.resize(index + 1); 514 subn[index] = name; 515 return this->self(); 516 } 517 518 /** 519 * Set the subfield description for the given index and marks this stat to 520 * print at the end of simulation. 521 * @param index The subfield index. 522 * @param desc The new description of the subfield 523 * @return A reference to this stat. 524 */ 525 Parent & |
526 subdesc(int index, const std::string &desc) | 526 subdesc(off_type index, const std::string &desc) |
527 { 528 std::vector<std::string> &subd = this->statData()->subdescs; 529 if (subd.size() <= index) 530 subd.resize(index + 1); 531 subd[index] = desc; 532 533 return this->self(); 534 } --- 8 unchanged lines hidden (view full) --- 543 * @warning This makes the assumption that if you're gonna subnames a 2d 544 * vector, you're subnaming across all y 545 */ 546 Parent & 547 ysubnames(const char **names) 548 { 549 Data<Child> *data = this->statData(); 550 data->y_subnames.resize(this->y); | 527 { 528 std::vector<std::string> &subd = this->statData()->subdescs; 529 if (subd.size() <= index) 530 subd.resize(index + 1); 531 subd[index] = desc; 532 533 return this->self(); 534 } --- 8 unchanged lines hidden (view full) --- 543 * @warning This makes the assumption that if you're gonna subnames a 2d 544 * vector, you're subnaming across all y 545 */ 546 Parent & 547 ysubnames(const char **names) 548 { 549 Data<Child> *data = this->statData(); 550 data->y_subnames.resize(this->y); |
551 for (int i = 0; i < this->y; ++i) | 551 for (off_type i = 0; i < this->y; ++i) |
552 data->y_subnames[i] = names[i]; 553 return this->self(); 554 } 555 556 Parent & | 552 data->y_subnames[i] = names[i]; 553 return this->self(); 554 } 555 556 Parent & |
557 ysubname(int index, const std::string subname) | 557 ysubname(off_type index, const std::string subname) |
558 { 559 Data<Child> *data = this->statData(); 560 assert(index < this->y); 561 data->y_subnames.resize(this->y); 562 data->y_subnames[index] = subname.c_str(); 563 return this->self(); 564 } 565}; --- 261 unchanged lines hidden (view full) --- 827 */ 828 template <typename U> 829 void operator-=(const U &v) { data()->dec(v, params); } 830 831 /** 832 * Return the number of elements, always 1 for a scalar. 833 * @return 1. 834 */ | 558 { 559 Data<Child> *data = this->statData(); 560 assert(index < this->y); 561 data->y_subnames.resize(this->y); 562 data->y_subnames[index] = subname.c_str(); 563 return this->self(); 564 } 565}; --- 261 unchanged lines hidden (view full) --- 827 */ 828 template <typename U> 829 void operator-=(const U &v) { data()->dec(v, params); } 830 831 /** 832 * Return the number of elements, always 1 for a scalar. 833 * @return 1. 834 */ |
835 size_t size() const { return 1; } | 835 size_type size() const { return 1; } |
836 837 bool check() const { return true; } 838 839 /** 840 * Reset stat value to default 841 */ 842 void reset() { data()->reset(); } 843 --- 7 unchanged lines hidden (view full) --- 851 852}; 853 854class ProxyData : public ScalarData 855{ 856 public: 857 virtual void visit(Visit &visitor) { visitor.visit(*this); } 858 virtual std::string str() const { return to_string(value()); } | 836 837 bool check() const { return true; } 838 839 /** 840 * Reset stat value to default 841 */ 842 void reset() { data()->reset(); } 843 --- 7 unchanged lines hidden (view full) --- 851 852}; 853 854class ProxyData : public ScalarData 855{ 856 public: 857 virtual void visit(Visit &visitor) { visitor.visit(*this); } 858 virtual std::string str() const { return to_string(value()); } |
859 virtual size_t size() const { return 1; } | 859 virtual size_type size() const { return 1; } |
860 virtual bool zero() const { return value() == 0; } 861 virtual bool check() const { return true; } 862 virtual void reset() { } 863}; 864 865template <class T> 866class ValueProxy : public ProxyData 867{ --- 43 unchanged lines hidden (view full) --- 911 { 912 proxy = new FunctorProxy<T>(func); 913 setInit(); 914 } 915 916 Counter value() { return proxy->value(); } 917 Result result() const { return proxy->result(); } 918 Result total() const { return proxy->total(); }; | 860 virtual bool zero() const { return value() == 0; } 861 virtual bool check() const { return true; } 862 virtual void reset() { } 863}; 864 865template <class T> 866class ValueProxy : public ProxyData 867{ --- 43 unchanged lines hidden (view full) --- 911 { 912 proxy = new FunctorProxy<T>(func); 913 setInit(); 914 } 915 916 Counter value() { return proxy->value(); } 917 Result result() const { return proxy->result(); } 918 Result total() const { return proxy->total(); }; |
919 size_t size() const { return proxy->size(); } | 919 size_type size() const { return proxy->size(); } |
920 921 std::string str() const { return proxy->str(); } 922 bool zero() const { return proxy->zero(); } 923 bool check() const { return proxy != NULL; } 924 void reset() { } 925}; 926 927////////////////////////////////////////////////////////////////////// --- 9 unchanged lines hidden (view full) --- 937template <class Stat> 938class ScalarProxy 939{ 940 private: 941 /** Pointer to the parent Vector. */ 942 Stat *stat; 943 944 /** The index to access in the parent VectorBase. */ | 920 921 std::string str() const { return proxy->str(); } 922 bool zero() const { return proxy->zero(); } 923 bool check() const { return proxy != NULL; } 924 void reset() { } 925}; 926 927////////////////////////////////////////////////////////////////////// --- 9 unchanged lines hidden (view full) --- 937template <class Stat> 938class ScalarProxy 939{ 940 private: 941 /** Pointer to the parent Vector. */ 942 Stat *stat; 943 944 /** The index to access in the parent VectorBase. */ |
945 int index; | 945 off_type index; |
946 947 public: 948 /** 949 * Return the current value of this stat as its base type. 950 * @return The current value. 951 */ 952 Counter value() const { return stat->data(index)->value(stat->params); } 953 --- 4 unchanged lines hidden (view full) --- 958 Result result() const { return stat->data(index)->result(stat->params); } 959 960 public: 961 /** 962 * Create and initialize this proxy, do not register it with the database. 963 * @param p The params to use. 964 * @param i The index to access. 965 */ | 946 947 public: 948 /** 949 * Return the current value of this stat as its base type. 950 * @return The current value. 951 */ 952 Counter value() const { return stat->data(index)->value(stat->params); } 953 --- 4 unchanged lines hidden (view full) --- 958 Result result() const { return stat->data(index)->result(stat->params); } 959 960 public: 961 /** 962 * Create and initialize this proxy, do not register it with the database. 963 * @param p The params to use. 964 * @param i The index to access. 965 */ |
966 ScalarProxy(Stat *s, int i) | 966 ScalarProxy(Stat *s, off_type i) |
967 : stat(s), index(i) 968 { 969 assert(stat); 970 } 971 972 /** 973 * Create a copy of the provided ScalarProxy. 974 * @param sp The proxy to copy. --- 67 unchanged lines hidden (view full) --- 1042 { 1043 stat->data(index)->dec(v, stat->params); 1044 } 1045 1046 /** 1047 * Return the number of elements, always 1 for a scalar. 1048 * @return 1. 1049 */ | 967 : stat(s), index(i) 968 { 969 assert(stat); 970 } 971 972 /** 973 * Create a copy of the provided ScalarProxy. 974 * @param sp The proxy to copy. --- 67 unchanged lines hidden (view full) --- 1042 { 1043 stat->data(index)->dec(v, stat->params); 1044 } 1045 1046 /** 1047 * Return the number of elements, always 1 for a scalar. 1048 * @return 1. 1049 */ |
1050 size_t size() const { return 1; } | 1050 size_type size() const { return 1; } |
1051 1052 /** 1053 * This stat has no state. Nothing to reset 1054 */ 1055 void reset() { } 1056 1057 public: 1058 std::string --- 19 unchanged lines hidden (view full) --- 1078 /** Proxy type */ 1079 typedef ScalarProxy<VectorBase<Storage> > Proxy; 1080 1081 friend class ScalarProxy<VectorBase<Storage> >; 1082 1083 protected: 1084 /** The storage of this stat. */ 1085 Storage *storage; | 1051 1052 /** 1053 * This stat has no state. Nothing to reset 1054 */ 1055 void reset() { } 1056 1057 public: 1058 std::string --- 19 unchanged lines hidden (view full) --- 1078 /** Proxy type */ 1079 typedef ScalarProxy<VectorBase<Storage> > Proxy; 1080 1081 friend class ScalarProxy<VectorBase<Storage> >; 1082 1083 protected: 1084 /** The storage of this stat. */ 1085 Storage *storage; |
1086 size_t _size; | 1086 size_type _size; |
1087 1088 /** The parameters for this stat. */ 1089 Params params; 1090 1091 protected: 1092 /** 1093 * Retrieve the storage. 1094 * @param index The vector index to access. 1095 * @return The storage object at the given index. 1096 */ | 1087 1088 /** The parameters for this stat. */ 1089 Params params; 1090 1091 protected: 1092 /** 1093 * Retrieve the storage. 1094 * @param index The vector index to access. 1095 * @return The storage object at the given index. 1096 */ |
1097 Storage *data(int index) { return &storage[index]; } | 1097 Storage *data(off_type index) { return &storage[index]; } |
1098 1099 /** 1100 * Retrieve a const pointer to the storage. 1101 * @param index The vector index to access. 1102 * @return A const pointer to the storage object at the given index. 1103 */ | 1098 1099 /** 1100 * Retrieve a const pointer to the storage. 1101 * @param index The vector index to access. 1102 * @return A const pointer to the storage object at the given index. 1103 */ |
1104 const Storage *data(int index) const { return &storage[index]; } | 1104 const Storage *data(off_type index) const { return &storage[index]; } |
1105 1106 void | 1105 1106 void |
1107 doInit(int s) | 1107 doInit(size_type s) |
1108 { 1109 assert(s > 0 && "size must be positive!"); 1110 assert(!storage && "already initialized"); 1111 _size = s; 1112 1113 char *ptr = new char[_size * sizeof(Storage)]; 1114 storage = reinterpret_cast<Storage *>(ptr); 1115 | 1108 { 1109 assert(s > 0 && "size must be positive!"); 1110 assert(!storage && "already initialized"); 1111 _size = s; 1112 1113 char *ptr = new char[_size * sizeof(Storage)]; 1114 storage = reinterpret_cast<Storage *>(ptr); 1115 |
1116 for (int i = 0; i < _size; ++i) | 1116 for (off_type i = 0; i < _size; ++i) |
1117 new (&storage[i]) Storage(params); 1118 1119 setInit(); 1120 } 1121 1122 public: 1123 void 1124 value(VCounter &vec) const 1125 { 1126 vec.resize(size()); | 1117 new (&storage[i]) Storage(params); 1118 1119 setInit(); 1120 } 1121 1122 public: 1123 void 1124 value(VCounter &vec) const 1125 { 1126 vec.resize(size()); |
1127 for (int i = 0; i < size(); ++i) | 1127 for (off_type i = 0; i < size(); ++i) |
1128 vec[i] = data(i)->value(params); 1129 } 1130 1131 /** 1132 * Copy the values to a local vector and return a reference to it. 1133 * @return A reference to a vector of the stat values. 1134 */ 1135 void 1136 result(VResult &vec) const 1137 { 1138 vec.resize(size()); | 1128 vec[i] = data(i)->value(params); 1129 } 1130 1131 /** 1132 * Copy the values to a local vector and return a reference to it. 1133 * @return A reference to a vector of the stat values. 1134 */ 1135 void 1136 result(VResult &vec) const 1137 { 1138 vec.resize(size()); |
1139 for (int i = 0; i < size(); ++i) | 1139 for (off_type i = 0; i < size(); ++i) |
1140 vec[i] = data(i)->result(params); 1141 } 1142 1143 /** 1144 * Return a total of all entries in this vector. 1145 * @return The total of all vector entries. 1146 */ 1147 Result 1148 total() const 1149 { 1150 Result total = 0.0; | 1140 vec[i] = data(i)->result(params); 1141 } 1142 1143 /** 1144 * Return a total of all entries in this vector. 1145 * @return The total of all vector entries. 1146 */ 1147 Result 1148 total() const 1149 { 1150 Result total = 0.0; |
1151 for (int i = 0; i < size(); ++i) | 1151 for (off_type i = 0; i < size(); ++i) |
1152 total += data(i)->result(params); 1153 return total; 1154 } 1155 1156 /** 1157 * @return the number of elements in this vector. 1158 */ | 1152 total += data(i)->result(params); 1153 return total; 1154 } 1155 1156 /** 1157 * @return the number of elements in this vector. 1158 */ |
1159 size_t size() const { return _size; } | 1159 size_type size() const { return _size; } |
1160 1161 bool 1162 zero() const 1163 { | 1160 1161 bool 1162 zero() const 1163 { |
1164 for (int i = 0; i < size(); ++i) | 1164 for (off_type i = 0; i < size(); ++i) |
1165 if (data(i)->zero()) 1166 return false; 1167 return true; 1168 } 1169 1170 bool 1171 check() const 1172 { 1173 return storage != NULL; 1174 } 1175 1176 void 1177 reset() 1178 { | 1165 if (data(i)->zero()) 1166 return false; 1167 return true; 1168 } 1169 1170 bool 1171 check() const 1172 { 1173 return storage != NULL; 1174 } 1175 1176 void 1177 reset() 1178 { |
1179 for (int i = 0; i < size(); ++i) | 1179 for (off_type i = 0; i < size(); ++i) |
1180 data(i)->reset(); 1181 } 1182 1183 public: 1184 VectorBase() 1185 : storage(NULL) 1186 {} 1187 1188 ~VectorBase() 1189 { 1190 if (!storage) 1191 return; 1192 | 1180 data(i)->reset(); 1181 } 1182 1183 public: 1184 VectorBase() 1185 : storage(NULL) 1186 {} 1187 1188 ~VectorBase() 1189 { 1190 if (!storage) 1191 return; 1192 |
1193 for (int i = 0; i < _size; ++i) | 1193 for (off_type i = 0; i < _size; ++i) |
1194 data(i)->~Storage(); 1195 delete [] reinterpret_cast<char *>(storage); 1196 } 1197 1198 /** 1199 * Return a reference (ScalarProxy) to the stat at the given index. 1200 * @param index The vector index to access. 1201 * @return A reference of the stat. 1202 */ 1203 Proxy | 1194 data(i)->~Storage(); 1195 delete [] reinterpret_cast<char *>(storage); 1196 } 1197 1198 /** 1199 * Return a reference (ScalarProxy) to the stat at the given index. 1200 * @param index The vector index to access. 1201 * @return A reference of the stat. 1202 */ 1203 Proxy |
1204 operator[](int index) | 1204 operator[](off_type index) |
1205 { 1206 assert (index >= 0 && index < size()); 1207 return Proxy(this, index); 1208 } 1209 1210 void update(StatData *data) {} 1211}; 1212 1213template <class Stat> 1214class VectorProxy 1215{ 1216 private: 1217 Stat *stat; | 1205 { 1206 assert (index >= 0 && index < size()); 1207 return Proxy(this, index); 1208 } 1209 1210 void update(StatData *data) {} 1211}; 1212 1213template <class Stat> 1214class VectorProxy 1215{ 1216 private: 1217 Stat *stat; |
1218 int offset; 1219 int len; | 1218 off_type offset; 1219 size_type len; |
1220 1221 private: 1222 mutable VResult vec; 1223 1224 typename Stat::Storage * | 1220 1221 private: 1222 mutable VResult vec; 1223 1224 typename Stat::Storage * |
1225 data(int index) | 1225 data(off_type index) |
1226 { 1227 assert(index < len); 1228 return stat->data(offset + index); 1229 } 1230 1231 const typename Stat::Storage * | 1226 { 1227 assert(index < len); 1228 return stat->data(offset + index); 1229 } 1230 1231 const typename Stat::Storage * |
1232 data(int index) const | 1232 data(off_type index) const |
1233 { 1234 assert(index < len); 1235 return const_cast<Stat *>(stat)->data(offset + index); 1236 } 1237 1238 public: 1239 const VResult & 1240 result() const 1241 { 1242 vec.resize(size()); 1243 | 1233 { 1234 assert(index < len); 1235 return const_cast<Stat *>(stat)->data(offset + index); 1236 } 1237 1238 public: 1239 const VResult & 1240 result() const 1241 { 1242 vec.resize(size()); 1243 |
1244 for (int i = 0; i < size(); ++i) | 1244 for (off_type i = 0; i < size(); ++i) |
1245 vec[i] = data(i)->result(stat->params); 1246 1247 return vec; 1248 } 1249 1250 Result 1251 total() const 1252 { 1253 Result total = 0; | 1245 vec[i] = data(i)->result(stat->params); 1246 1247 return vec; 1248 } 1249 1250 Result 1251 total() const 1252 { 1253 Result total = 0; |
1254 for (int i = 0; i < size(); ++i) | 1254 for (off_type i = 0; i < size(); ++i) |
1255 total += data(i)->result(stat->params); 1256 return total; 1257 } 1258 1259 public: | 1255 total += data(i)->result(stat->params); 1256 return total; 1257 } 1258 1259 public: |
1260 VectorProxy(Stat *s, int o, int l) | 1260 VectorProxy(Stat *s, off_type o, size_type l) |
1261 : stat(s), offset(o), len(l) 1262 { 1263 } 1264 1265 VectorProxy(const VectorProxy &sp) 1266 : stat(sp.stat), offset(sp.offset), len(sp.len) 1267 { 1268 } 1269 1270 const VectorProxy & 1271 operator=(const VectorProxy &sp) 1272 { 1273 stat = sp.stat; 1274 offset = sp.offset; 1275 len = sp.len; 1276 return *this; 1277 } 1278 1279 ScalarProxy<Stat> | 1261 : stat(s), offset(o), len(l) 1262 { 1263 } 1264 1265 VectorProxy(const VectorProxy &sp) 1266 : stat(sp.stat), offset(sp.offset), len(sp.len) 1267 { 1268 } 1269 1270 const VectorProxy & 1271 operator=(const VectorProxy &sp) 1272 { 1273 stat = sp.stat; 1274 offset = sp.offset; 1275 len = sp.len; 1276 return *this; 1277 } 1278 1279 ScalarProxy<Stat> |
1280 operator[](int index) | 1280 operator[](off_type index) |
1281 { 1282 assert (index >= 0 && index < size()); 1283 return ScalarProxy<Stat>(stat, offset + index); 1284 } 1285 | 1281 { 1282 assert (index >= 0 && index < size()); 1283 return ScalarProxy<Stat>(stat, offset + index); 1284 } 1285 |
1286 size_t size() const { return len; } | 1286 size_type size() const { return len; } |
1287 1288 /** 1289 * This stat has no state. Nothing to reset. 1290 */ 1291 void reset() { } 1292}; 1293 1294template <class Stor> 1295class Vector2dBase : public DataAccess 1296{ 1297 public: 1298 typedef Stor Storage; 1299 typedef typename Storage::Params Params; 1300 typedef VectorProxy<Vector2dBase<Storage> > Proxy; 1301 friend class ScalarProxy<Vector2dBase<Storage> >; 1302 friend class VectorProxy<Vector2dBase<Storage> >; 1303 1304 protected: | 1287 1288 /** 1289 * This stat has no state. Nothing to reset. 1290 */ 1291 void reset() { } 1292}; 1293 1294template <class Stor> 1295class Vector2dBase : public DataAccess 1296{ 1297 public: 1298 typedef Stor Storage; 1299 typedef typename Storage::Params Params; 1300 typedef VectorProxy<Vector2dBase<Storage> > Proxy; 1301 friend class ScalarProxy<Vector2dBase<Storage> >; 1302 friend class VectorProxy<Vector2dBase<Storage> >; 1303 1304 protected: |
1305 size_t x; 1306 size_t y; 1307 size_t _size; | 1305 size_type x; 1306 size_type y; 1307 size_type _size; |
1308 Storage *storage; 1309 Params params; 1310 1311 protected: | 1308 Storage *storage; 1309 Params params; 1310 1311 protected: |
1312 Storage *data(int index) { return &storage[index]; } 1313 const Storage *data(int index) const { return &storage[index]; } | 1312 Storage *data(off_type index) { return &storage[index]; } 1313 const Storage *data(off_type index) const { return &storage[index]; } |
1314 1315 void | 1314 1315 void |
1316 doInit(int _x, int _y) | 1316 doInit(size_type _x, size_type _y) |
1317 { 1318 assert(_x > 0 && _y > 0 && "sizes must be positive!"); 1319 assert(!storage && "already initialized"); 1320 1321 Vector2dData *statdata = dynamic_cast<Vector2dData *>(find()); 1322 1323 x = _x; 1324 y = _y; 1325 statdata->x = _x; 1326 statdata->y = _y; 1327 _size = x * y; 1328 1329 char *ptr = new char[_size * sizeof(Storage)]; 1330 storage = reinterpret_cast<Storage *>(ptr); 1331 | 1317 { 1318 assert(_x > 0 && _y > 0 && "sizes must be positive!"); 1319 assert(!storage && "already initialized"); 1320 1321 Vector2dData *statdata = dynamic_cast<Vector2dData *>(find()); 1322 1323 x = _x; 1324 y = _y; 1325 statdata->x = _x; 1326 statdata->y = _y; 1327 _size = x * y; 1328 1329 char *ptr = new char[_size * sizeof(Storage)]; 1330 storage = reinterpret_cast<Storage *>(ptr); 1331 |
1332 for (int i = 0; i < _size; ++i) | 1332 for (off_type i = 0; i < _size; ++i) |
1333 new (&storage[i]) Storage(params); 1334 1335 setInit(); 1336 } 1337 1338 public: 1339 Vector2dBase() 1340 : storage(NULL) 1341 {} 1342 1343 ~Vector2dBase() 1344 { 1345 if (!storage) 1346 return; 1347 | 1333 new (&storage[i]) Storage(params); 1334 1335 setInit(); 1336 } 1337 1338 public: 1339 Vector2dBase() 1340 : storage(NULL) 1341 {} 1342 1343 ~Vector2dBase() 1344 { 1345 if (!storage) 1346 return; 1347 |
1348 for (int i = 0; i < _size; ++i) | 1348 for (off_type i = 0; i < _size; ++i) |
1349 data(i)->~Storage(); 1350 delete [] reinterpret_cast<char *>(storage); 1351 } 1352 1353 void 1354 update(Vector2dData *newdata) 1355 { | 1349 data(i)->~Storage(); 1350 delete [] reinterpret_cast<char *>(storage); 1351 } 1352 1353 void 1354 update(Vector2dData *newdata) 1355 { |
1356 int size = this->size(); | 1356 size_type size = this->size(); |
1357 newdata->cvec.resize(size); | 1357 newdata->cvec.resize(size); |
1358 for (int i = 0; i < size; ++i) | 1358 for (off_type i = 0; i < size; ++i) |
1359 newdata->cvec[i] = data(i)->value(params); 1360 } 1361 | 1359 newdata->cvec[i] = data(i)->value(params); 1360 } 1361 |
1362 std::string ysubname(int i) const { return (*this->y_subnames)[i]; } | 1362 std::string ysubname(off_type i) const { return (*this->y_subnames)[i]; } |
1363 1364 Proxy | 1363 1364 Proxy |
1365 operator[](int index) | 1365 operator[](off_type index) |
1366 { | 1366 { |
1367 int offset = index * y; | 1367 off_type offset = index * y; |
1368 assert (index >= 0 && offset + index < size()); 1369 return Proxy(this, offset, y); 1370 } 1371 1372 | 1368 assert (index >= 0 && offset + index < size()); 1369 return Proxy(this, offset, y); 1370 } 1371 1372 |
1373 size_t | 1373 size_type |
1374 size() const 1375 { 1376 return _size; 1377 } 1378 1379 bool 1380 zero() const 1381 { 1382 return data(0)->zero(); 1383#if 0 | 1374 size() const 1375 { 1376 return _size; 1377 } 1378 1379 bool 1380 zero() const 1381 { 1382 return data(0)->zero(); 1383#if 0 |
1384 for (int i = 0; i < size(); ++i) | 1384 for (off_type i = 0; i < size(); ++i) |
1385 if (!data(i)->zero()) 1386 return false; 1387 return true; 1388#endif 1389 } 1390 1391 /** 1392 * Reset stat value to default 1393 */ 1394 void 1395 reset() 1396 { | 1385 if (!data(i)->zero()) 1386 return false; 1387 return true; 1388#endif 1389 } 1390 1391 /** 1392 * Reset stat value to default 1393 */ 1394 void 1395 reset() 1396 { |
1397 for (int i = 0; i < size(); ++i) | 1397 for (off_type i = 0; i < size(); ++i) |
1398 data(i)->reset(); 1399 } 1400 1401 bool 1402 check() 1403 { 1404 return storage != NULL; 1405 } --- 16 unchanged lines hidden (view full) --- 1422 { 1423 /** The minimum value to track. */ 1424 Counter min; 1425 /** The maximum value to track. */ 1426 Counter max; 1427 /** The number of entries in each bucket. */ 1428 Counter bucket_size; 1429 /** The number of buckets. Equal to (max-min)/bucket_size. */ | 1398 data(i)->reset(); 1399 } 1400 1401 bool 1402 check() 1403 { 1404 return storage != NULL; 1405 } --- 16 unchanged lines hidden (view full) --- 1422 { 1423 /** The minimum value to track. */ 1424 Counter min; 1425 /** The maximum value to track. */ 1426 Counter max; 1427 /** The number of entries in each bucket. */ 1428 Counter bucket_size; 1429 /** The number of buckets. Equal to (max-min)/bucket_size. */ |
1430 int size; | 1430 size_type size; |
1431 }; 1432 enum { fancy = false }; 1433 1434 private: 1435 /** The smallest value sampled. */ 1436 Counter min_val; 1437 /** The largest value sampled. */ 1438 Counter max_val; --- 26 unchanged lines hidden (view full) --- 1465 void 1466 sample(Counter val, int number, const Params ¶ms) 1467 { 1468 if (val < params.min) 1469 underflow += number; 1470 else if (val > params.max) 1471 overflow += number; 1472 else { | 1431 }; 1432 enum { fancy = false }; 1433 1434 private: 1435 /** The smallest value sampled. */ 1436 Counter min_val; 1437 /** The largest value sampled. */ 1438 Counter max_val; --- 26 unchanged lines hidden (view full) --- 1465 void 1466 sample(Counter val, int number, const Params ¶ms) 1467 { 1468 if (val < params.min) 1469 underflow += number; 1470 else if (val > params.max) 1471 overflow += number; 1472 else { |
1473 size_t index = std::floor((val - params.min) / params.bucket_size); | 1473 size_type index = 1474 (size_type)std::floor((val - params.min) / params.bucket_size); |
1474 assert(index < size(params)); 1475 cvec[index] += number; 1476 } 1477 1478 if (val < min_val) 1479 min_val = val; 1480 1481 if (val > max_val) --- 5 unchanged lines hidden (view full) --- 1487 samples += number; 1488 } 1489 1490 /** 1491 * Return the number of buckets in this distribution. 1492 * @return the number of buckets. 1493 * @todo Is it faster to return the size from the parameters? 1494 */ | 1475 assert(index < size(params)); 1476 cvec[index] += number; 1477 } 1478 1479 if (val < min_val) 1480 min_val = val; 1481 1482 if (val > max_val) --- 5 unchanged lines hidden (view full) --- 1488 samples += number; 1489 } 1490 1491 /** 1492 * Return the number of buckets in this distribution. 1493 * @return the number of buckets. 1494 * @todo Is it faster to return the size from the parameters? 1495 */ |
1495 size_t size(const Params &) const { return cvec.size(); } | 1496 size_type size(const Params &) const { return cvec.size(); } |
1496 1497 /** 1498 * Returns true if any calls to sample have been made. 1499 * @param params The paramters of the distribution. 1500 * @return True if any values have been sampled. 1501 */ 1502 bool 1503 zero(const Params ¶ms) const --- 9 unchanged lines hidden (view full) --- 1513 data->bucket_size = params.bucket_size; 1514 data->size = params.size; 1515 1516 data->min_val = (min_val == CounterLimits::max()) ? 0 : min_val; 1517 data->max_val = (max_val == CounterLimits::min()) ? 0 : max_val; 1518 data->underflow = underflow; 1519 data->overflow = overflow; 1520 data->cvec.resize(params.size); | 1497 1498 /** 1499 * Returns true if any calls to sample have been made. 1500 * @param params The paramters of the distribution. 1501 * @return True if any values have been sampled. 1502 */ 1503 bool 1504 zero(const Params ¶ms) const --- 9 unchanged lines hidden (view full) --- 1514 data->bucket_size = params.bucket_size; 1515 data->size = params.size; 1516 1517 data->min_val = (min_val == CounterLimits::max()) ? 0 : min_val; 1518 data->max_val = (max_val == CounterLimits::min()) ? 0 : max_val; 1519 data->underflow = underflow; 1520 data->overflow = overflow; 1521 data->cvec.resize(params.size); |
1521 for (int i = 0; i < params.size; ++i) | 1522 for (off_type i = 0; i < params.size; ++i) |
1522 data->cvec[i] = cvec[i]; 1523 1524 data->sum = sum; 1525 data->squares = squares; 1526 data->samples = samples; 1527 } 1528 1529 /** 1530 * Reset stat value to default 1531 */ 1532 void 1533 reset() 1534 { 1535 min_val = CounterLimits::max(); 1536 max_val = CounterLimits::min(); 1537 underflow = 0; 1538 overflow = 0; 1539 | 1523 data->cvec[i] = cvec[i]; 1524 1525 data->sum = sum; 1526 data->squares = squares; 1527 data->samples = samples; 1528 } 1529 1530 /** 1531 * Reset stat value to default 1532 */ 1533 void 1534 reset() 1535 { 1536 min_val = CounterLimits::max(); 1537 max_val = CounterLimits::min(); 1538 underflow = 0; 1539 overflow = 0; 1540 |
1540 int size = cvec.size(); 1541 for (int i = 0; i < size; ++i) | 1541 size_type size = cvec.size(); 1542 for (off_type i = 0; i < size; ++i) |
1542 cvec[i] = Counter(); 1543 1544 sum = Counter(); 1545 squares = Counter(); 1546 samples = Counter(); 1547 } 1548}; 1549 --- 50 unchanged lines hidden (view full) --- 1600 data->squares = squares; 1601 data->samples = samples; 1602 } 1603 1604 /** 1605 * Return the number of entries in this stat, 1 1606 * @return 1. 1607 */ | 1543 cvec[i] = Counter(); 1544 1545 sum = Counter(); 1546 squares = Counter(); 1547 samples = Counter(); 1548 } 1549}; 1550 --- 50 unchanged lines hidden (view full) --- 1601 data->squares = squares; 1602 data->samples = samples; 1603 } 1604 1605 /** 1606 * Return the number of entries in this stat, 1 1607 * @return 1. 1608 */ |
1608 size_t size(const Params &) const { return 1; } | 1609 size_type size(const Params &) const { return 1; } |
1609 1610 /** 1611 * Return true if no samples have been added. 1612 * @return True if no samples have been added. 1613 */ 1614 bool zero(const Params &) const { return samples == Counter(); } 1615 1616 /** --- 53 unchanged lines hidden (view full) --- 1670 data->squares = squares; 1671 data->samples = curTick; 1672 } 1673 1674 /** 1675 * Return the number of entries, in this case 1. 1676 * @return 1. 1677 */ | 1610 1611 /** 1612 * Return true if no samples have been added. 1613 * @return True if no samples have been added. 1614 */ 1615 bool zero(const Params &) const { return samples == Counter(); } 1616 1617 /** --- 53 unchanged lines hidden (view full) --- 1671 data->squares = squares; 1672 data->samples = curTick; 1673 } 1674 1675 /** 1676 * Return the number of entries, in this case 1. 1677 * @return 1. 1678 */ |
1678 size_t size(const Params ¶ms) const { return 1; } | 1679 size_type size(const Params ¶ms) const { return 1; } |
1679 1680 /** 1681 * Return true if no samples have been added. 1682 * @return True if the sum is zero. 1683 */ 1684 bool zero(const Params ¶ms) const { return sum == Counter(); } 1685 1686 /** --- 65 unchanged lines hidden (view full) --- 1752 */ 1753 template <typename U> 1754 void sample(const U &v, int n = 1) { data()->sample(v, n, params); } 1755 1756 /** 1757 * Return the number of entries in this stat. 1758 * @return The number of entries. 1759 */ | 1680 1681 /** 1682 * Return true if no samples have been added. 1683 * @return True if the sum is zero. 1684 */ 1685 bool zero(const Params ¶ms) const { return sum == Counter(); } 1686 1687 /** --- 65 unchanged lines hidden (view full) --- 1753 */ 1754 template <typename U> 1755 void sample(const U &v, int n = 1) { data()->sample(v, n, params); } 1756 1757 /** 1758 * Return the number of entries in this stat. 1759 * @return The number of entries. 1760 */ |
1760 size_t size() const { return data()->size(params); } | 1761 size_type size() const { return data()->size(params); } |
1761 /** 1762 * Return true if no samples have been added. 1763 * @return True if there haven't been any samples. 1764 */ 1765 bool zero() const { return data()->zero(params); } 1766 1767 void 1768 update(DistData *base) --- 27 unchanged lines hidden (view full) --- 1796 public: 1797 typedef Stor Storage; 1798 typedef typename Storage::Params Params; 1799 typedef DistProxy<VectorDistBase<Storage> > Proxy; 1800 friend class DistProxy<VectorDistBase<Storage> >; 1801 1802 protected: 1803 Storage *storage; | 1762 /** 1763 * Return true if no samples have been added. 1764 * @return True if there haven't been any samples. 1765 */ 1766 bool zero() const { return data()->zero(params); } 1767 1768 void 1769 update(DistData *base) --- 27 unchanged lines hidden (view full) --- 1797 public: 1798 typedef Stor Storage; 1799 typedef typename Storage::Params Params; 1800 typedef DistProxy<VectorDistBase<Storage> > Proxy; 1801 friend class DistProxy<VectorDistBase<Storage> >; 1802 1803 protected: 1804 Storage *storage; |
1804 size_t _size; | 1805 size_type _size; |
1805 Params params; 1806 1807 protected: 1808 Storage * | 1806 Params params; 1807 1808 protected: 1809 Storage * |
1809 data(int index) | 1810 data(off_type index) |
1810 { 1811 return &storage[index]; 1812 } 1813 1814 const Storage * | 1811 { 1812 return &storage[index]; 1813 } 1814 1815 const Storage * |
1815 data(int index) const | 1816 data(off_type index) const |
1816 { 1817 return &storage[index]; 1818 } 1819 1820 void | 1817 { 1818 return &storage[index]; 1819 } 1820 1821 void |
1821 doInit(int s) | 1822 doInit(size_type s) |
1822 { 1823 assert(s > 0 && "size must be positive!"); 1824 assert(!storage && "already initialized"); 1825 _size = s; 1826 1827 char *ptr = new char[_size * sizeof(Storage)]; 1828 storage = reinterpret_cast<Storage *>(ptr); 1829 | 1823 { 1824 assert(s > 0 && "size must be positive!"); 1825 assert(!storage && "already initialized"); 1826 _size = s; 1827 1828 char *ptr = new char[_size * sizeof(Storage)]; 1829 storage = reinterpret_cast<Storage *>(ptr); 1830 |
1830 for (int i = 0; i < _size; ++i) | 1831 for (off_type i = 0; i < _size; ++i) |
1831 new (&storage[i]) Storage(params); 1832 1833 setInit(); 1834 } 1835 1836 public: 1837 VectorDistBase() 1838 : storage(NULL) 1839 {} 1840 1841 ~VectorDistBase() 1842 { 1843 if (!storage) 1844 return ; 1845 | 1832 new (&storage[i]) Storage(params); 1833 1834 setInit(); 1835 } 1836 1837 public: 1838 VectorDistBase() 1839 : storage(NULL) 1840 {} 1841 1842 ~VectorDistBase() 1843 { 1844 if (!storage) 1845 return ; 1846 |
1846 for (int i = 0; i < _size; ++i) | 1847 for (off_type i = 0; i < _size; ++i) |
1847 data(i)->~Storage(); 1848 delete [] reinterpret_cast<char *>(storage); 1849 } 1850 | 1848 data(i)->~Storage(); 1849 delete [] reinterpret_cast<char *>(storage); 1850 } 1851 |
1851 Proxy operator[](int index); | 1852 Proxy operator[](off_type index); |
1852 | 1853 |
1853 size_t | 1854 size_type |
1854 size() const 1855 { 1856 return _size; 1857 } 1858 1859 bool 1860 zero() const 1861 { 1862 return false; 1863#if 0 | 1855 size() const 1856 { 1857 return _size; 1858 } 1859 1860 bool 1861 zero() const 1862 { 1863 return false; 1864#if 0 |
1864 for (int i = 0; i < size(); ++i) | 1865 for (off_type i = 0; i < size(); ++i) |
1865 if (!data(i)->zero(params)) 1866 return false; 1867 return true; 1868#endif 1869 } 1870 1871 /** 1872 * Reset stat value to default 1873 */ 1874 void 1875 reset() 1876 { | 1866 if (!data(i)->zero(params)) 1867 return false; 1868 return true; 1869#endif 1870 } 1871 1872 /** 1873 * Reset stat value to default 1874 */ 1875 void 1876 reset() 1877 { |
1877 for (int i = 0; i < size(); ++i) | 1878 for (off_type i = 0; i < size(); ++i) |
1878 data(i)->reset(); 1879 } 1880 1881 bool 1882 check() 1883 { 1884 return storage != NULL; 1885 } 1886 1887 void 1888 update(VectorDistData *base) 1889 { | 1879 data(i)->reset(); 1880 } 1881 1882 bool 1883 check() 1884 { 1885 return storage != NULL; 1886 } 1887 1888 void 1889 update(VectorDistData *base) 1890 { |
1890 int size = this->size(); | 1891 size_type size = this->size(); |
1891 base->data.resize(size); | 1892 base->data.resize(size); |
1892 for (int i = 0; i < size; ++i) { | 1893 for (off_type i = 0; i < size; ++i) { |
1893 base->data[i].fancy = Storage::fancy; 1894 data(i)->update(&(base->data[i]), params); 1895 } 1896 } 1897}; 1898 1899template <class Stat> 1900class DistProxy 1901{ 1902 private: 1903 Stat *stat; | 1894 base->data[i].fancy = Storage::fancy; 1895 data(i)->update(&(base->data[i]), params); 1896 } 1897 } 1898}; 1899 1900template <class Stat> 1901class DistProxy 1902{ 1903 private: 1904 Stat *stat; |
1904 int index; | 1905 off_type index; |
1905 1906 protected: 1907 typename Stat::Storage *data() { return stat->data(index); } 1908 const typename Stat::Storage *data() const { return stat->data(index); } 1909 1910 public: | 1906 1907 protected: 1908 typename Stat::Storage *data() { return stat->data(index); } 1909 const typename Stat::Storage *data() const { return stat->data(index); } 1910 1911 public: |
1911 DistProxy(Stat *s, int i) | 1912 DistProxy(Stat *s, off_type i) |
1912 : stat(s), index(i) 1913 {} 1914 1915 DistProxy(const DistProxy &sp) 1916 : stat(sp.stat), index(sp.index) 1917 {} 1918 1919 const DistProxy & --- 7 unchanged lines hidden (view full) --- 1927 public: 1928 template <typename U> 1929 void 1930 sample(const U &v, int n = 1) 1931 { 1932 data()->sample(v, n, stat->params); 1933 } 1934 | 1913 : stat(s), index(i) 1914 {} 1915 1916 DistProxy(const DistProxy &sp) 1917 : stat(sp.stat), index(sp.index) 1918 {} 1919 1920 const DistProxy & --- 7 unchanged lines hidden (view full) --- 1928 public: 1929 template <typename U> 1930 void 1931 sample(const U &v, int n = 1) 1932 { 1933 data()->sample(v, n, stat->params); 1934 } 1935 |
1935 size_t | 1936 size_type |
1936 size() const 1937 { 1938 return 1; 1939 } 1940 1941 bool 1942 zero() const 1943 { 1944 return data()->zero(stat->params); 1945 } 1946 1947 /** 1948 * Proxy has no state. Nothing to reset. 1949 */ 1950 void reset() { } 1951}; 1952 1953template <class Storage> 1954inline typename VectorDistBase<Storage>::Proxy | 1937 size() const 1938 { 1939 return 1; 1940 } 1941 1942 bool 1943 zero() const 1944 { 1945 return data()->zero(stat->params); 1946 } 1947 1948 /** 1949 * Proxy has no state. Nothing to reset. 1950 */ 1951 void reset() { } 1952}; 1953 1954template <class Storage> 1955inline typename VectorDistBase<Storage>::Proxy |
1955VectorDistBase<Storage>::operator[](int index) | 1956VectorDistBase<Storage>::operator[](off_type index) |
1956{ 1957 assert (index >= 0 && index < size()); 1958 return typename VectorDistBase<Storage>::Proxy(this, index); 1959} 1960 1961#if 0 1962template <class Storage> 1963Result | 1957{ 1958 assert (index >= 0 && index < size()); 1959 return typename VectorDistBase<Storage>::Proxy(this, index); 1960} 1961 1962#if 0 1963template <class Storage> 1964Result |
1964VectorDistBase<Storage>::total(int index) const | 1965VectorDistBase<Storage>::total(off_type index) const |
1965{ | 1966{ |
1966 int total = 0; 1967 for (int i = 0; i < x_size(); ++i) | 1967 Result total = 0; 1968 for (off_type i = 0; i < x_size(); ++i) |
1968 total += data(i)->result(stat->params); 1969} 1970#endif 1971 1972////////////////////////////////////////////////////////////////////// 1973// 1974// Formula Details 1975// --- 5 unchanged lines hidden (view full) --- 1981 */ 1982class Node : public RefCounted 1983{ 1984 public: 1985 /** 1986 * Return the number of nodes in the subtree starting at this node. 1987 * @return the number of nodes in this subtree. 1988 */ | 1969 total += data(i)->result(stat->params); 1970} 1971#endif 1972 1973////////////////////////////////////////////////////////////////////// 1974// 1975// Formula Details 1976// --- 5 unchanged lines hidden (view full) --- 1982 */ 1983class Node : public RefCounted 1984{ 1985 public: 1986 /** 1987 * Return the number of nodes in the subtree starting at this node. 1988 * @return the number of nodes in this subtree. 1989 */ |
1989 virtual size_t size() const = 0; | 1990 virtual size_type size() const = 0; |
1990 /** 1991 * Return the result vector of this subtree. 1992 * @return The result vector of this subtree. 1993 */ 1994 virtual const VResult &result() const = 0; 1995 /** 1996 * Return the total of the result vector. 1997 * @return The total of the result vector. --- 22 unchanged lines hidden (view full) --- 2020 result() const 2021 { 2022 vresult[0] = data->result(); 2023 return vresult; 2024 } 2025 2026 virtual Result total() const { return data->result(); }; 2027 | 1991 /** 1992 * Return the result vector of this subtree. 1993 * @return The result vector of this subtree. 1994 */ 1995 virtual const VResult &result() const = 0; 1996 /** 1997 * Return the total of the result vector. 1998 * @return The total of the result vector. --- 22 unchanged lines hidden (view full) --- 2021 result() const 2022 { 2023 vresult[0] = data->result(); 2024 return vresult; 2025 } 2026 2027 virtual Result total() const { return data->result(); }; 2028 |
2028 virtual size_t size() const { return 1; } | 2029 virtual size_type size() const { return 1; } |
2029 2030 /** 2031 * 2032 */ 2033 virtual std::string str() const { return data->name; } 2034}; 2035 2036template <class Stat> --- 16 unchanged lines hidden (view full) --- 2053 } 2054 2055 virtual Result 2056 total() const 2057 { 2058 return proxy.result(); 2059 } 2060 | 2030 2031 /** 2032 * 2033 */ 2034 virtual std::string str() const { return data->name; } 2035}; 2036 2037template <class Stat> --- 16 unchanged lines hidden (view full) --- 2054 } 2055 2056 virtual Result 2057 total() const 2058 { 2059 return proxy.result(); 2060 } 2061 |
2061 virtual size_t | 2062 virtual size_type |
2062 size() const 2063 { 2064 return 1; 2065 } 2066 2067 /** 2068 * 2069 */ --- 9 unchanged lines hidden (view full) --- 2079 private: 2080 const VectorData *data; 2081 2082 public: 2083 VectorStatNode(const VectorData *d) : data(d) { } 2084 virtual const VResult &result() const { return data->result(); } 2085 virtual Result total() const { return data->total(); }; 2086 | 2063 size() const 2064 { 2065 return 1; 2066 } 2067 2068 /** 2069 * 2070 */ --- 9 unchanged lines hidden (view full) --- 2080 private: 2081 const VectorData *data; 2082 2083 public: 2084 VectorStatNode(const VectorData *d) : data(d) { } 2085 virtual const VResult &result() const { return data->result(); } 2086 virtual Result total() const { return data->total(); }; 2087 |
2087 virtual size_t size() const { return data->size(); } | 2088 virtual size_type size() const { return data->size(); } |
2088 2089 virtual std::string str() const { return data->name; } 2090}; 2091 2092template <class T> 2093class ConstNode : public Node 2094{ 2095 private: 2096 VResult vresult; 2097 2098 public: 2099 ConstNode(T s) : vresult(1, (Result)s) {} 2100 const VResult &result() const { return vresult; } 2101 virtual Result total() const { return vresult[0]; }; | 2089 2090 virtual std::string str() const { return data->name; } 2091}; 2092 2093template <class T> 2094class ConstNode : public Node 2095{ 2096 private: 2097 VResult vresult; 2098 2099 public: 2100 ConstNode(T s) : vresult(1, (Result)s) {} 2101 const VResult &result() const { return vresult; } 2102 virtual Result total() const { return vresult[0]; }; |
2102 virtual size_t size() const { return 1; } | 2103 virtual size_type size() const { return 1; } |
2103 virtual std::string str() const { return to_string(vresult[0]); } 2104}; 2105 2106template <class T> 2107class ConstVectorNode : public Node 2108{ 2109 private: 2110 VResult vresult; 2111 2112 public: 2113 ConstVectorNode(const T &s) : vresult(s.begin(), s.end()) {} 2114 const VResult &result() const { return vresult; } 2115 2116 virtual Result 2117 total() const 2118 { | 2104 virtual std::string str() const { return to_string(vresult[0]); } 2105}; 2106 2107template <class T> 2108class ConstVectorNode : public Node 2109{ 2110 private: 2111 VResult vresult; 2112 2113 public: 2114 ConstVectorNode(const T &s) : vresult(s.begin(), s.end()) {} 2115 const VResult &result() const { return vresult; } 2116 2117 virtual Result 2118 total() const 2119 { |
2119 int size = this->size(); | 2120 size_type size = this->size(); |
2120 Result tmp = 0; | 2121 Result tmp = 0; |
2121 for (int i = 0; i < size; i++) | 2122 for (off_type i = 0; i < size; i++) |
2122 tmp += vresult[i]; 2123 return tmp; 2124 } 2125 | 2123 tmp += vresult[i]; 2124 return tmp; 2125 } 2126 |
2126 virtual size_t size() const { return vresult.size(); } | 2127 virtual size_type size() const { return vresult.size(); } |
2127 virtual std::string 2128 str() const 2129 { | 2128 virtual std::string 2129 str() const 2130 { |
2130 int size = this->size(); | 2131 size_type size = this->size(); |
2131 std::string tmp = "("; | 2132 std::string tmp = "("; |
2132 for (int i = 0; i < size; i++) | 2133 for (off_type i = 0; i < size; i++) |
2133 tmp += csprintf("%s ",to_string(vresult[i])); 2134 tmp += ")"; 2135 return tmp; 2136 } 2137}; 2138 2139template <class Op> 2140struct OpString; --- 43 unchanged lines hidden (view full) --- 2184 2185 public: 2186 UnaryNode(NodePtr &p) : l(p) {} 2187 2188 const VResult & 2189 result() const 2190 { 2191 const VResult &lvec = l->result(); | 2134 tmp += csprintf("%s ",to_string(vresult[i])); 2135 tmp += ")"; 2136 return tmp; 2137 } 2138}; 2139 2140template <class Op> 2141struct OpString; --- 43 unchanged lines hidden (view full) --- 2185 2186 public: 2187 UnaryNode(NodePtr &p) : l(p) {} 2188 2189 const VResult & 2190 result() const 2191 { 2192 const VResult &lvec = l->result(); |
2192 int size = lvec.size(); | 2193 size_type size = lvec.size(); |
2193 2194 assert(size > 0); 2195 2196 vresult.resize(size); 2197 Op op; | 2194 2195 assert(size > 0); 2196 2197 vresult.resize(size); 2198 Op op; |
2198 for (int i = 0; i < size; ++i) | 2199 for (off_type i = 0; i < size; ++i) |
2199 vresult[i] = op(lvec[i]); 2200 2201 return vresult; 2202 } 2203 2204 Result 2205 total() const 2206 { 2207 const VResult &vec = this->result(); 2208 Result total = 0; | 2200 vresult[i] = op(lvec[i]); 2201 2202 return vresult; 2203 } 2204 2205 Result 2206 total() const 2207 { 2208 const VResult &vec = this->result(); 2209 Result total = 0; |
2209 for (int i = 0; i < size(); i++) | 2210 for (off_type i = 0; i < size(); i++) |
2210 total += vec[i]; 2211 return total; 2212 } 2213 | 2211 total += vec[i]; 2212 return total; 2213 } 2214 |
2214 virtual size_t size() const { return l->size(); } | 2215 virtual size_type size() const { return l->size(); } |
2215 2216 virtual std::string 2217 str() const 2218 { 2219 return OpString<Op>::str() + l->str(); 2220 } 2221}; 2222 --- 16 unchanged lines hidden (view full) --- 2239 const VResult &rvec = r->result(); 2240 2241 assert(lvec.size() > 0 && rvec.size() > 0); 2242 2243 if (lvec.size() == 1 && rvec.size() == 1) { 2244 vresult.resize(1); 2245 vresult[0] = op(lvec[0], rvec[0]); 2246 } else if (lvec.size() == 1) { | 2216 2217 virtual std::string 2218 str() const 2219 { 2220 return OpString<Op>::str() + l->str(); 2221 } 2222}; 2223 --- 16 unchanged lines hidden (view full) --- 2240 const VResult &rvec = r->result(); 2241 2242 assert(lvec.size() > 0 && rvec.size() > 0); 2243 2244 if (lvec.size() == 1 && rvec.size() == 1) { 2245 vresult.resize(1); 2246 vresult[0] = op(lvec[0], rvec[0]); 2247 } else if (lvec.size() == 1) { |
2247 int size = rvec.size(); | 2248 size_type size = rvec.size(); |
2248 vresult.resize(size); | 2249 vresult.resize(size); |
2249 for (int i = 0; i < size; ++i) | 2250 for (off_type i = 0; i < size; ++i) |
2250 vresult[i] = op(lvec[0], rvec[i]); 2251 } else if (rvec.size() == 1) { | 2251 vresult[i] = op(lvec[0], rvec[i]); 2252 } else if (rvec.size() == 1) { |
2252 int size = lvec.size(); | 2253 size_type size = lvec.size(); |
2253 vresult.resize(size); | 2254 vresult.resize(size); |
2254 for (int i = 0; i < size; ++i) | 2255 for (off_type i = 0; i < size; ++i) |
2255 vresult[i] = op(lvec[i], rvec[0]); 2256 } else if (rvec.size() == lvec.size()) { | 2256 vresult[i] = op(lvec[i], rvec[0]); 2257 } else if (rvec.size() == lvec.size()) { |
2257 int size = rvec.size(); | 2258 size_type size = rvec.size(); |
2258 vresult.resize(size); | 2259 vresult.resize(size); |
2259 for (int i = 0; i < size; ++i) | 2260 for (off_type i = 0; i < size; ++i) |
2260 vresult[i] = op(lvec[i], rvec[i]); 2261 } 2262 2263 return vresult; 2264 } 2265 2266 Result 2267 total() const 2268 { 2269 const VResult &vec = this->result(); 2270 Result total = 0; | 2261 vresult[i] = op(lvec[i], rvec[i]); 2262 } 2263 2264 return vresult; 2265 } 2266 2267 Result 2268 total() const 2269 { 2270 const VResult &vec = this->result(); 2271 Result total = 0; |
2271 for (int i = 0; i < size(); i++) | 2272 for (off_type i = 0; i < size(); i++) |
2272 total += vec[i]; 2273 return total; 2274 } 2275 | 2273 total += vec[i]; 2274 return total; 2275 } 2276 |
2276 virtual size_t | 2277 virtual size_type |
2277 size() const 2278 { | 2278 size() const 2279 { |
2279 int ls = l->size(); 2280 int rs = r->size(); | 2280 size_type ls = l->size(); 2281 size_type rs = r->size(); |
2281 if (ls == 1) { 2282 return rs; 2283 } else if (rs == 1) { 2284 return ls; 2285 } else { 2286 assert(ls == rs && "Node vector sizes are not equal"); 2287 return ls; 2288 } --- 15 unchanged lines hidden (view full) --- 2304 2305 public: 2306 SumNode(NodePtr &p) : l(p), vresult(1) {} 2307 2308 const VResult & 2309 result() const 2310 { 2311 const VResult &lvec = l->result(); | 2282 if (ls == 1) { 2283 return rs; 2284 } else if (rs == 1) { 2285 return ls; 2286 } else { 2287 assert(ls == rs && "Node vector sizes are not equal"); 2288 return ls; 2289 } --- 15 unchanged lines hidden (view full) --- 2305 2306 public: 2307 SumNode(NodePtr &p) : l(p), vresult(1) {} 2308 2309 const VResult & 2310 result() const 2311 { 2312 const VResult &lvec = l->result(); |
2312 int size = lvec.size(); | 2313 size_type size = lvec.size(); |
2313 assert(size > 0); 2314 2315 vresult[0] = 0.0; 2316 2317 Op op; | 2314 assert(size > 0); 2315 2316 vresult[0] = 0.0; 2317 2318 Op op; |
2318 for (int i = 0; i < size; ++i) | 2319 for (off_type i = 0; i < size; ++i) |
2319 vresult[0] = op(vresult[0], lvec[i]); 2320 2321 return vresult; 2322 } 2323 2324 Result 2325 total() const 2326 { 2327 const VResult &lvec = l->result(); | 2320 vresult[0] = op(vresult[0], lvec[i]); 2321 2322 return vresult; 2323 } 2324 2325 Result 2326 total() const 2327 { 2328 const VResult &lvec = l->result(); |
2328 int size = lvec.size(); | 2329 size_type size = lvec.size(); |
2329 assert(size > 0); 2330 2331 Result vresult = 0.0; 2332 2333 Op op; | 2330 assert(size > 0); 2331 2332 Result vresult = 0.0; 2333 2334 Op op; |
2334 for (int i = 0; i < size; ++i) | 2335 for (off_type i = 0; i < size; ++i) |
2335 vresult = op(vresult, lvec[i]); 2336 2337 return vresult; 2338 } 2339 | 2336 vresult = op(vresult, lvec[i]); 2337 2338 return vresult; 2339 } 2340 |
2340 virtual size_t size() const { return 1; } | 2341 virtual size_type size() const { return 1; } |
2341 2342 virtual std::string 2343 str() const 2344 { 2345 return csprintf("total(%s)", l->str()); 2346 } 2347}; 2348 --- 98 unchanged lines hidden (view full) --- 2447 typedef ScalarBase<StatStor> Base; 2448 2449 /** 2450 * Set this vector to have the given size. 2451 * @param size The new size. 2452 * @return A reference to this stat. 2453 */ 2454 Vector & | 2342 2343 virtual std::string 2344 str() const 2345 { 2346 return csprintf("total(%s)", l->str()); 2347 } 2348}; 2349 --- 98 unchanged lines hidden (view full) --- 2448 typedef ScalarBase<StatStor> Base; 2449 2450 /** 2451 * Set this vector to have the given size. 2452 * @param size The new size. 2453 * @return A reference to this stat. 2454 */ 2455 Vector & |
2455 init(size_t size) | 2456 init(size_type size) |
2456 { 2457 this->doInit(size); 2458 return *this; 2459 } 2460}; 2461 2462/** 2463 * A vector of Average stats. --- 5 unchanged lines hidden (view full) --- 2469{ 2470 public: 2471 /** 2472 * Set this vector to have the given size. 2473 * @param size The new size. 2474 * @return A reference to this stat. 2475 */ 2476 AverageVector & | 2457 { 2458 this->doInit(size); 2459 return *this; 2460 } 2461}; 2462 2463/** 2464 * A vector of Average stats. --- 5 unchanged lines hidden (view full) --- 2470{ 2471 public: 2472 /** 2473 * Set this vector to have the given size. 2474 * @param size The new size. 2475 * @return A reference to this stat. 2476 */ 2477 AverageVector & |
2477 init(size_t size) | 2478 init(size_type size) |
2478 { 2479 this->doInit(size); 2480 return *this; 2481 } 2482}; 2483 2484/** 2485 * A 2-Dimensional vecto of scalar stats. 2486 * @sa Stat, Vector2dBase, StatStor 2487 */ 2488template<int N = 0> 2489class Vector2d 2490 : public WrapVec2d<Vector2d<N>, Vector2dBase<StatStor>, Vector2dStatData> 2491{ 2492 public: 2493 Vector2d & | 2479 { 2480 this->doInit(size); 2481 return *this; 2482 } 2483}; 2484 2485/** 2486 * A 2-Dimensional vecto of scalar stats. 2487 * @sa Stat, Vector2dBase, StatStor 2488 */ 2489template<int N = 0> 2490class Vector2d 2491 : public WrapVec2d<Vector2d<N>, Vector2dBase<StatStor>, Vector2dStatData> 2492{ 2493 public: 2494 Vector2d & |
2494 init(size_t x, size_t y) | 2495 init(size_type x, size_type y) |
2495 { 2496 this->doInit(x, y); 2497 return *this; 2498 } 2499}; 2500 2501/** 2502 * A simple distribution stat. --- 18 unchanged lines hidden (view full) --- 2521 * @return A reference to this distribution. 2522 */ 2523 Distribution & 2524 init(Counter min, Counter max, Counter bkt) 2525 { 2526 this->params.min = min; 2527 this->params.max = max; 2528 this->params.bucket_size = bkt; | 2496 { 2497 this->doInit(x, y); 2498 return *this; 2499 } 2500}; 2501 2502/** 2503 * A simple distribution stat. --- 18 unchanged lines hidden (view full) --- 2522 * @return A reference to this distribution. 2523 */ 2524 Distribution & 2525 init(Counter min, Counter max, Counter bkt) 2526 { 2527 this->params.min = min; 2528 this->params.max = max; 2529 this->params.bucket_size = bkt; |
2529 this->params.size = (int)rint((max - min) / bkt + 1.0); | 2530 this->params.size = (size_type)rint((max - min) / bkt + 1.0); |
2530 this->doInit(); 2531 return *this; 2532 } 2533}; 2534 2535/** 2536 * Calculates the mean and variance of all the samples. 2537 * @sa Stat, DistBase, FancyStor --- 63 unchanged lines hidden (view full) --- 2601 * Initialize storage and parameters for this distribution. 2602 * @param size The size of the vector (the number of distributions). 2603 * @param min The minimum value of the distribution. 2604 * @param max The maximum value of the distribution. 2605 * @param bkt The number of values in each bucket. 2606 * @return A reference to this distribution. 2607 */ 2608 VectorDistribution & | 2531 this->doInit(); 2532 return *this; 2533 } 2534}; 2535 2536/** 2537 * Calculates the mean and variance of all the samples. 2538 * @sa Stat, DistBase, FancyStor --- 63 unchanged lines hidden (view full) --- 2602 * Initialize storage and parameters for this distribution. 2603 * @param size The size of the vector (the number of distributions). 2604 * @param min The minimum value of the distribution. 2605 * @param max The maximum value of the distribution. 2606 * @param bkt The number of values in each bucket. 2607 * @return A reference to this distribution. 2608 */ 2609 VectorDistribution & |
2609 init(int size, Counter min, Counter max, Counter bkt) | 2610 init(size_type size, Counter min, Counter max, Counter bkt) |
2610 { 2611 this->params.min = min; 2612 this->params.max = max; 2613 this->params.bucket_size = bkt; | 2611 { 2612 this->params.min = min; 2613 this->params.max = max; 2614 this->params.bucket_size = bkt; |
2614 this->params.size = (int)rint((max - min) / bkt + 1.0); | 2615 this->params.size = rint((max - min) / bkt + 1.0); |
2615 this->doInit(size); 2616 return *this; 2617 } 2618}; 2619 2620/** 2621 * This is a vector of StandardDeviation stats. 2622 * @sa Stat, VectorDistBase, FancyStor --- 12 unchanged lines hidden (view full) --- 2635 2636 public: 2637 /** 2638 * Initialize storage for this distribution. 2639 * @param size The size of the vector. 2640 * @return A reference to this distribution. 2641 */ 2642 VectorStandardDeviation & | 2616 this->doInit(size); 2617 return *this; 2618 } 2619}; 2620 2621/** 2622 * This is a vector of StandardDeviation stats. 2623 * @sa Stat, VectorDistBase, FancyStor --- 12 unchanged lines hidden (view full) --- 2636 2637 public: 2638 /** 2639 * Initialize storage for this distribution. 2640 * @param size The size of the vector. 2641 * @return A reference to this distribution. 2642 */ 2643 VectorStandardDeviation & |
2643 init(int size) | 2644 init(size_type size) |
2644 { 2645 this->doInit(size); 2646 return *this; 2647 } 2648}; 2649 2650/** 2651 * This is a vector of AverageDeviation stats. --- 13 unchanged lines hidden (view full) --- 2665 2666 public: 2667 /** 2668 * Initialize storage for this distribution. 2669 * @param size The size of the vector. 2670 * @return A reference to this distribution. 2671 */ 2672 VectorAverageDeviation & | 2645 { 2646 this->doInit(size); 2647 return *this; 2648 } 2649}; 2650 2651/** 2652 * This is a vector of AverageDeviation stats. --- 13 unchanged lines hidden (view full) --- 2666 2667 public: 2668 /** 2669 * Initialize storage for this distribution. 2670 * @param size The size of the vector. 2671 * @return A reference to this distribution. 2672 */ 2673 VectorAverageDeviation & |
2673 init(int size) | 2674 init(size_type size) |
2674 { 2675 this->doInit(size); 2676 return *this; 2677 } 2678}; 2679 2680/** 2681 * A formula for statistics that is calculated when printed. A formula is --- 27 unchanged lines hidden (view full) --- 2709 * the first entry in the VResult val() returns. 2710 * @return The total of the result vector. 2711 */ 2712 Result total() const; 2713 2714 /** 2715 * Return the number of elements in the tree. 2716 */ | 2675 { 2676 this->doInit(size); 2677 return *this; 2678 } 2679}; 2680 2681/** 2682 * A formula for statistics that is calculated when printed. A formula is --- 27 unchanged lines hidden (view full) --- 2710 * the first entry in the VResult val() returns. 2711 * @return The total of the result vector. 2712 */ 2713 Result total() const; 2714 2715 /** 2716 * Return the number of elements in the tree. 2717 */ |
2717 size_t size() const; | 2718 size_type size() const; |
2718 2719 bool check() const { return true; } 2720 2721 /** 2722 * Formulas don't need to be reset 2723 */ 2724 void reset(); 2725 --- 26 unchanged lines hidden (view full) --- 2752 mutable VCounter cvec; 2753 2754 public: 2755 FormulaStatData(Stat &stat) : s(stat) {} 2756 2757 virtual bool zero() const { return s.zero(); } 2758 virtual void reset() { s.reset(); } 2759 | 2719 2720 bool check() const { return true; } 2721 2722 /** 2723 * Formulas don't need to be reset 2724 */ 2725 void reset(); 2726 --- 26 unchanged lines hidden (view full) --- 2753 mutable VCounter cvec; 2754 2755 public: 2756 FormulaStatData(Stat &stat) : s(stat) {} 2757 2758 virtual bool zero() const { return s.zero(); } 2759 virtual void reset() { s.reset(); } 2760 |
2760 virtual size_t size() const { return s.size(); } | 2761 virtual size_type size() const { return s.size(); } |
2761 2762 virtual const VResult & 2763 result() const 2764 { 2765 s.result(vec); 2766 return vec; 2767 } 2768 virtual Result total() const { return s.total(); } --- 48 unchanged lines hidden (view full) --- 2817{ 2818 private: 2819 const Formula &formula; 2820 mutable VResult vec; 2821 2822 public: 2823 FormulaNode(const Formula &f) : formula(f) {} 2824 | 2762 2763 virtual const VResult & 2764 result() const 2765 { 2766 s.result(vec); 2767 return vec; 2768 } 2769 virtual Result total() const { return s.total(); } --- 48 unchanged lines hidden (view full) --- 2818{ 2819 private: 2820 const Formula &formula; 2821 mutable VResult vec; 2822 2823 public: 2824 FormulaNode(const Formula &f) : formula(f) {} 2825 |
2825 virtual size_t size() const { return formula.size(); } | 2826 virtual size_type size() const { return formula.size(); } |
2826 virtual const VResult &result() const { formula.result(vec); return vec; } 2827 virtual Result total() const { return formula.total(); } 2828 2829 virtual std::string str() const { return formula.str(); } 2830}; 2831 2832/** 2833 * Helper class to construct formula node trees. --- 234 unchanged lines hidden --- | 2827 virtual const VResult &result() const { formula.result(vec); return vec; } 2828 virtual Result total() const { return formula.total(); } 2829 2830 virtual std::string str() const { return formula.str(); } 2831}; 2832 2833/** 2834 * Helper class to construct formula node trees. --- 234 unchanged lines hidden --- |