diff options
author | Nathan Binkert <nate@binkert.org> | 2011-05-12 11:19:32 -0700 |
---|---|---|
committer | Nathan Binkert <nate@binkert.org> | 2011-05-12 11:19:32 -0700 |
commit | 35b0c1d3910595875de67a34f6b993047470fd55 (patch) | |
tree | f38c0a5a48492f6294ade11776963dfb84a763c5 /src/python/swig | |
parent | 9c4c1419a7d83e9bc39c94aa0a37dd1bbbecc38d (diff) | |
download | gem5-35b0c1d3910595875de67a34f6b993047470fd55.tar.xz |
stats: better expose statistics to python.
Build a python list and dict of all stats and expose flags properly.
--HG--
rename : src/python/m5/stats.py => src/python/m5/stats/__init__.py
Diffstat (limited to 'src/python/swig')
-rw-r--r-- | src/python/swig/stats.i | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/python/swig/stats.i b/src/python/swig/stats.i index 72172ae94..63539ca83 100644 --- a/src/python/swig/stats.i +++ b/src/python/swig/stats.i @@ -32,20 +32,68 @@ %include <std_list.i> %include <std_string.i> +%include <std_vector.i> +%include <stdint.i> %{ #include "base/stats/mysql.hh" #include "base/stats/text.hh" +#include "base/stats/types.hh" #include "base/statistics.hh" #include "sim/core.hh" #include "sim/stat_control.hh" + +namespace Stats { +template <class T> +inline T +cast_info(Info *info) +{ + return dynamic_cast<T>(info); +} + +inline FlagsType +Stats_Info_flags_get(Info *info) +{ + return info->flags; +} + +inline void +Stats_Info_flags_set(Info *info, FlagsType flags) +{ + info->flags = flags; +} + +} // namespace Stats %} +%extend Stats::Info { + short flags; +} + +%ignore Stats::Info::flags; + %import "base/stats/types.hh" %include "base/stats/info.hh" +namespace std { +%template(list_info) list<Stats::Info *>; +%template(vector_double) vector<double>; +%template(vector_string) vector<string>; +%template(vector_DistData) vector<Stats::DistData>; +} + namespace Stats { + +template <class T> T cast_info(Info *info); + +%template(dynamic_ScalarInfo) cast_info<ScalarInfo *>; +%template(dynamic_VectorInfo) cast_info<VectorInfo *>; +%template(dynamic_DistInfo) cast_info<DistInfo *>; +%template(dynamic_VectorDistInfo) cast_info<VectorDistInfo *>; +%template(dynamic_Vector2dInfo) cast_info<Vector2dInfo *>; +%template(dynamic_FormulaInfo) cast_info<FormulaInfo *>; + void initSimStats(); void initText(const std::string &filename, bool desc); void initMySQL(std::string host, std::string database, std::string user, |