From 35b0c1d3910595875de67a34f6b993047470fd55 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Thu, 12 May 2011 11:19:32 -0700 Subject: 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 --- src/python/swig/stats.i | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'src/python/swig/stats.i') 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 %include +%include +%include %{ #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 +inline T +cast_info(Info *info) +{ + return dynamic_cast(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; +%template(vector_double) vector; +%template(vector_string) vector; +%template(vector_DistData) vector; +} + namespace Stats { + +template T cast_info(Info *info); + +%template(dynamic_ScalarInfo) cast_info; +%template(dynamic_VectorInfo) cast_info; +%template(dynamic_DistInfo) cast_info; +%template(dynamic_VectorDistInfo) cast_info; +%template(dynamic_Vector2dInfo) cast_info; +%template(dynamic_FormulaInfo) cast_info; + void initSimStats(); void initText(const std::string &filename, bool desc); void initMySQL(std::string host, std::string database, std::string user, -- cgit v1.2.3