ADTarm-ehast-experimentalcleanup-dtorsenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since 92d41a4 was
4f97937,
checked in by tdelisle <tdelisle@…>, 5 years ago
|
First draft at timing results, left is better printing and more data
|
-
Property mode set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[1cb7fab2] | 1 | // |
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2019 University of Waterloo |
---|
| 3 | // |
---|
| 4 | // The contents of this file are covered under the licence agreement in the |
---|
| 5 | // file "LICENCE" distributed with Cforall. |
---|
| 6 | // |
---|
| 7 | // Stats.cc -- |
---|
| 8 | // |
---|
| 9 | // Author : Thierry Delisle |
---|
| 10 | // Created On : Fri Mar 01 15:45:08 2019 |
---|
| 11 | // Last Modified By : |
---|
| 12 | // Last Modified On : |
---|
| 13 | // Update Count : |
---|
| 14 | // |
---|
| 15 | |
---|
| 16 | #include <iostream> |
---|
| 17 | #include <sstream> |
---|
| 18 | #include <string> |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | namespace Stats { |
---|
| 22 | namespace Counters { |
---|
| 23 | bool enabled = false; |
---|
| 24 | void print(); |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | namespace Heap { |
---|
| 28 | bool enabled = false; |
---|
| 29 | void print(); |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | namespace Time { |
---|
| 33 | bool enabled = false; |
---|
[4f97937] | 34 | void print(); |
---|
[1cb7fab2] | 35 | } |
---|
| 36 | |
---|
| 37 | struct { |
---|
| 38 | const char * const opt; |
---|
| 39 | bool & enabled; |
---|
| 40 | } |
---|
| 41 | statistics[] = { |
---|
| 42 | { "counters", Counters::enabled }, |
---|
| 43 | { "heap" , Heap::enabled }, |
---|
| 44 | { "time" , Time::enabled }, |
---|
| 45 | }; |
---|
| 46 | |
---|
| 47 | void set_param(std::string & param) { |
---|
| 48 | if(param == "all") { |
---|
| 49 | for(auto & stat : statistics) { |
---|
| 50 | stat.enabled = true; |
---|
| 51 | } |
---|
| 52 | return; |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | if(param == "none") { |
---|
| 56 | for(auto & stat : statistics) { |
---|
| 57 | stat.enabled = false; |
---|
| 58 | } |
---|
| 59 | return; |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | for(auto & stat : statistics) { |
---|
| 63 | if(stat.opt == param) { |
---|
| 64 | stat.enabled = true; |
---|
| 65 | return; |
---|
| 66 | } |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | std::cerr << "Ignoring unknown statistic " << param << std::endl; |
---|
| 70 | } |
---|
| 71 | |
---|
| 72 | void parse_params(const char * const params) { |
---|
| 73 | std::stringstream ss(params); |
---|
| 74 | while(ss.good()) { |
---|
| 75 | std::string substr; |
---|
| 76 | getline( ss, substr, ',' ); |
---|
| 77 | set_param(substr); |
---|
| 78 | } |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | void print() { |
---|
| 82 | Counters::print(); |
---|
| 83 | Heap::print(); |
---|
| 84 | Time::print(); |
---|
| 85 | } |
---|
| 86 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.