SST/macro
stat_spyplot.h
Go to the documentation of this file.
1 /*
2  * This file is part of SST/macroscale:
3  * The macroscale architecture simulator from the SST suite.
4  * Copyright (c) 2009 Sandia Corporation.
5  * This software is distributed under the BSD License.
6  * Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
7  * the U.S. Government retains certain rights in this software.
8  * For more information, see the LICENSE file in the top
9  * SST/macroscale directory.
10  */
11 
12 #ifndef SSTMAC_COMMON_STATS_STATS_COMMON_H_INCLUDED
13 #define SSTMAC_COMMON_STATS_STATS_COMMON_H_INCLUDED
14 
17 #include <iostream>
18 #include <fstream>
19 #include <map>
20 #include <sprockit/unordered.h>
21 
22 namespace sstmac {
23 
24 
25 /**
26  * this stat_collector class keeps a spy plot
27  */
28 class stat_spyplot :
29  public stat_collector
30 {
31  public:
32  virtual std::string
33  to_string() const {
34  return "stat_spyplot";
35  }
36 
37  virtual void
39 
40  virtual void
41  dump_to_file(const std::string& froot);
42 
43  virtual void
45 
46  virtual void
48 
49  virtual void
50  reduce(stat_collector *coll);
51 
52  virtual void
54 
55  virtual void
56  clear();
57 
58  virtual
60  }
61 
62  virtual void
63  add_one(int source, int dest);
64 
65  virtual void
66  add(int source, int dest, long num);
67 
68  virtual stat_spyplot*
69  clone_me(int id) const {
70  stat_spyplot* cln = new stat_spyplot;
71  clone_into(cln);
72  cln->set_id(id);
73  return cln;
74  }
75 
76  virtual stat_collector*
77  clone() const {
78  return clone_me(-1);
79  }
80 
82 
83  protected:
84  void
85  clone_into(stat_spyplot* cln) const;
86 
87  protected:
88  typedef spkt_unordered_map<int, long> long_map;
89  typedef spkt_unordered_map<int, long_map> spyplot_map;
90  spyplot_map vals_;
91  int max_dest_;
92 
93 };
94 
95 /**
96  * this stat_collector class keeps a spy plot, and outputs it as a png
97  */
99 {
100  public:
102  fill_(false),
103  normalization_(-1) {
104  }
105 
106  virtual std::string
107  to_string() const {
108  return "stat_spyplot_png";
109  }
110 
111  virtual void
112  add(int source, int dest, long num);
113 
114  virtual void
115  dump_to_file(const std::string& froot);
116 
117  void
118  set_normalization(long max) {
119  normalization_ = max;
120  }
121 
122  virtual void
123  init_factory_params(sprockit::sim_parameters *params);
124 
125  virtual
127  }
128 
129  stat_spyplot*
130  clone_me(int id) const {
132  clone_into(cln);
133  cln->set_id(id);
134  return cln;
135  }
136 
138  clone() const {
139  return clone_me(-1);
140  }
141 
142  protected:
143  void
144  clone_into(stat_spyplot_png* cln) const;
145 
146  protected:
148  bool fill_;
149 
150 };
151 
152 }
153 
154 #endif
155 
virtual void global_reduce(parallel_runtime *rt)
virtual std::string to_string() const
Definition: stat_spyplot.h:33
virtual void add_one(int source, int dest)
void clone_into(stat_spyplot *cln) const
virtual void dump_global_data()
After post-processing, this notifies the collector to dump data to a file.
virtual stat_collector * clone() const
Definition: stat_spyplot.h:77
A type of logger that collects some kind of statistic and outputs to a file during or at the end of a...
virtual ~stat_spyplot()
Definition: stat_spyplot.h:59
virtual void reduce(stat_collector *coll)
virtual void set_id(int id)
stat_collector * clone() const
Definition: stat_spyplot.h:138
void set_normalization(long max)
Definition: stat_spyplot.h:118
virtual stat_spyplot * clone_me(int id) const
Definition: stat_spyplot.h:69
virtual void simulation_finished(timestamp end)
This is to notify that the statistics collector is done.
A basic container for time (subject to future transplant).
Definition: timestamp.h:29
virtual void add(int source, int dest, long num)
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
spkt_unordered_map< int, long > long_map
Definition: stat_spyplot.h:88
virtual void clear()
this stat_collector class keeps a spy plot
Definition: stat_spyplot.h:28
virtual std::string to_string() const
Definition: stat_spyplot.h:107
virtual void dump_local_data()
After post-processing, this notifies the collector to dump data to a file.
spkt_unordered_map< int, long_map > spyplot_map
Definition: stat_spyplot.h:89
virtual void dump_to_file(const std::string &froot)
stat_spyplot * clone_me(int id) const
Definition: stat_spyplot.h:130
this stat_collector class keeps a spy plot, and outputs it as a png
Definition: stat_spyplot.h:98
virtual void init_factory_params(sprockit::sim_parameters *params)