Add get_data methodes
This commit is contained in:
parent
2431e4b9bc
commit
8210800683
6
.vscode/settings.json
vendored
6
.vscode/settings.json
vendored
@ -4,6 +4,10 @@
|
||||
"ostream": "cpp",
|
||||
"string": "cpp",
|
||||
"vector": "cpp",
|
||||
"map": "cpp"
|
||||
"map": "cpp",
|
||||
"*.tcc": "cpp",
|
||||
"deque": "cpp",
|
||||
"unordered_map": "cpp",
|
||||
"system_error": "cpp"
|
||||
}
|
||||
}
|
@ -54,6 +54,17 @@ class Metrics {
|
||||
*/
|
||||
vector<string> keys();
|
||||
|
||||
/**
|
||||
* Metoda vraća map<string, uint> svih mjerenja
|
||||
*/
|
||||
map<string, uint> get_data();
|
||||
|
||||
/**
|
||||
* Metoda vraća map<string, uint> svih mjerenja i resetira brojače
|
||||
*/
|
||||
map<string, uint> get_data_and_clear();
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -22,3 +22,14 @@ vector<string> marcelb::Metrics::keys() {
|
||||
return _keys;
|
||||
}
|
||||
|
||||
|
||||
map<string, uint> marcelb::Metrics::get_data() {
|
||||
return counters;
|
||||
}
|
||||
|
||||
|
||||
map<string, uint> marcelb::Metrics::get_data_and_clear() {
|
||||
auto data = counters;
|
||||
clear();
|
||||
return counters;
|
||||
}
|
@ -17,5 +17,6 @@ int main() {
|
||||
cout << " access " << metrika["access"] << endl;
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user