History log of /gem5/src/base/stats/text.cc
Revision Date Author Comments
# 14205:197360deaa20 26-Jun-2019 Andreas Sandberg <andreas.sandberg@arm.com>

stats: Add support for hierarchical stats

This change makes the stat system aware of the hierarchical nature of
stats. The aim is to achieve the following goals:

* Make the SimObject hierarchy explicit in the stat system (i.e.,
get rid of name() + ".foo"). This makes stat naming less fragile
and makes it possible to implement hierarchical formats like
XML/HDF5/JSON in a clean way.

* Make it more convenient to split stats into a separate
struct/class that can be bound to a SimObject. This makes the
namespace cleaner and makes stat accesses a bit more obvious.

* Make it possible to build groups of stats in C++ that can be used
in subcomponents in a SimObject (similar to what we do for
checkpoint sections). This makes it easier to structure large
components.

* Enable partial stat dumps. Some of our internal users have been
asking for this since a full stat dump can be large.

* Enable better stat access from Python.

This changeset implements solves the first three points by introducing
a class (Stats::Group) that owns statistics belonging to the same
object. SimObjects inherit from Stats::Group since they typically have
statistics.

New-style statistics need to be associated with a parent group at
instantiation time. Instantiation typically sets the name and the
description, other parameters need to be set by overriding
Group::regStats() just like with legacy stats. Simple objects with
scalar stats can typically avoid implementing regStats() altogether
since the stat name and description are both specified in the
constructor.

For convenience reasons, statistics groups can be merged into other
groups. This means that a SimObject can create a stat struct that
inherits from Stats::Group and merge it into the parent group
(SimObject). This can make the code cleaner since statistics tracking
gets grouped into a single object.

Stat visitors have a new API to expose the group structure. The
Output::beginGroup(name) method is called at the beginning of a group
and the Output::endGroup() method is called when all stats, and
sub-groups, have been visited. Flat formats (e.g., the text format)
typically need to maintain a stack to track the full path to a stat.

Legacy, flat, statistics are still supported after applying this
change. These stats don't belong to any group and stat visitors will
not see a Output::beginGroup(name) call before their corresponding
Output::visit() methods are called.

Change-Id: I9025d61dfadeabcc8ecf30813ab2060def455648
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/19368
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>


# 12334:e0ab29a34764 30-Nov-2017 Gabe Black <gabeblack@google.com>

misc: Rename misc.(hh|cc) to logging.(hh|cc)

These files aren't a collection of miscellaneous stuff, they're the
definition of the Logger interface, and a few utility macros for
calling into that interface (panic, warn, etc.).

Change-Id: I84267ac3f45896a83c0ef027f8f19c5e9a5667d1
Reviewed-on: https://gem5-review.googlesource.com/6226
Reviewed-by: Brandon Potter <Brandon.Potter@amd.com>
Maintainer: Gabe Black <gabeblack@google.com>


# 11793:ef606668d247 09-Nov-2016 Brandon Potter <brandon.potter@amd.com>

style: [patch 1/22] use /r/3648/ to reorganize includes


# 11565:9b9116df5e88 21-Jul-2016 David Guillen Fandos <david.guillen@arm.com>

base: Add total() to Vector2D stat

This patch adds a total() function to the Vector2D
stat type. Similar to other stats such as Scalar or
Vector it is useful to be able to read the total for
a given stat.


# 11359:b0b976a1ceda 27-Nov-2015 Andreas Sandberg <andreas@sandberg.pp.se>

base: Add support for changing output directories

This changeset adds support for changing the simulator output
directory. This can be useful when the simulation goes through several
stages (e.g., a warming phase, a simulation phase, and a verification
phase) since it allows the output from each stage to be located in a
different directory. Relocation is done by calling core.setOutputDir()
from Python or simout.setOutputDirectory() from C++.

This change affects several parts of the design of the gem5's output
subsystem. First, files returned by an OutputDirectory instance (e.g.,
simout) are of the type OutputStream instead of a std::ostream. This
allows us to do some more book keeping and control re-opening of files
when the output directory is changed. Second, new subdirectories are
OutputDirectory instances, which should be used to create files in
that sub-directory.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
[sascha.bischoff@arm.com: Rebased patches onto a newer gem5 version]
Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>


# 10386:c81407818741 20-Sep-2014 Andreas Hansson <andreas.hansson@arm.com>

base: Clean up redundant string functions and use C++11

This patch does a bit of housekeeping on the string helper functions
and relies on the C++11 standard library where possible. It also does
away with our custom string hash as an implementation is already part
of the standard library.


# 10374:1813597a92ec 19-Sep-2014 Andreas Hansson <andreas.hansson@arm.com>

stats: Fix flow-control bug in Vector2D printing


# 10011:69bd1011dcf3 10-Jan-2014 Nilay Vaish <nilay@cs.wisc.edu>

stats: add function for adding two histograms
This patch adds a function to the HistStor class for adding two histograms.
This functionality is required for Ruby. It also adds support for printing
histograms in a single line.


# 9839:97ef15178067 20-Aug-2013 Andreas Hansson <andreas.hansson@arm.com>

base: Fix VectorPrint initialisation

This patch changes how the initialisation of the VectorPrint struct is
done so that gcc 4.4 is happy again.


# 9828:4807b780ed0a 19-Aug-2013 Sascha Bischoff <sascha.bischoff@arm.com>

stats: Fix issue when printing 2D vectors

This patch addresses an issue with the text-based stats output which
resulted in Vector2D stats being printed without subnames in the event
that one of the dimensions was of length 1.

This patch also fixes the total printing for the 2D vector. Previously
totals were printed without explicitly stating that a total was being
printed. This has been rectified in this patch.


# 9777:68b47cb5c0a6 27-Jun-2013 Sascha Bischoff <sascha.bischoff@arm.com>

stats: Remove printing of SparseHist total

This patch removes the printing of the SparseHist total in the
stats.txt output file. This has been removed as a sparse histogram has
no total, and therefore this was printing out the value of a
non-local, unrelated variable.


# 9743:436a74146cbc 09-Jun-2013 Nilay Vaish <nilay@cs.wisc.edu>

stats: allow printing vectors on a single line
This patch adds a new flag to specify if the data values for a given vector
should be printed in one line in the stats.txt file. The default behavior
will be to print the data in multiple lines. It makes changes to print
functions to enforce this behavior.


# 9420:965d857ac791 07-Jan-2013 Andreas Hansson <andreas.hansson@arm.com>

scons: Enforce gcc >= 4.4 or clang >= 2.9 and c++0x support

This patch checks that the compiler in use is either gcc >= 4.4 or
clang >= 2.9. and enables building with --std=c++0x in all cases. As a
consequence, we can tidy up the hashmap and always have static_assert
available. If anyone wants to use alternative compilers, icc for
example supports c++0x to a similar level and could be added if
needed.

This patch opens up for a more elaborate use of c++0x features that
are present in gcc 4.4 and clang 2.9, e.g. auto typed variables,
variadic templates, rvalues and move semantics, and strongly typed
enums. There will be no going back on this one...


# 8982:06ce6d08caaa 09-May-2012 Nathan Binkert <nate@binkert.org>

stats: use nan instead of no_value


# 8946:fb6c89334b86 14-Apr-2012 Andreas Hansson <andreas.hansson@arm.com>

clang/gcc: Fix compilation issues with clang 3.0 and gcc 4.6

This patch addresses a number of minor issues that cause problems when
compiling with clang >= 3.0 and gcc >= 4.6. Most importantly, it
avoids using the deprecated ext/hash_map and instead uses
unordered_map (and similarly so for the hash_set). To make use of the
new STL containers, g++ and clang has to be invoked with "-std=c++0x",
and this is now added for all gcc versions >= 4.6, and for clang >=
3.0. For gcc >= 4.3 and <= 4.5 and clang <= 3.0 we use the tr1
unordered_map to avoid the deprecation warning.

The addition of c++0x in turn causes a few problems, as the
compiler is more stringent and adds a number of new warnings. Below,
the most important issues are enumerated:

1) the use of namespaces is more strict, e.g. for isnan, and all
headers opening the entire namespace std are now fixed.

2) another other issue caused by the more stringent compiler is the
narrowing of the embedded python, which used to be a char array,
and is now unsigned char since there were values larger than 128.

3) a particularly odd issue that arose with the new c++0x behaviour is
found in range.hh, where the operator< causes gcc to complain about
the template type parsing (the "<" is interpreted as the beginning
of a template argument), and the problem seems to be related to the
begin/end members introduced for the range-type iteration, which is
a new feature in c++11.

As a minor update, this patch also fixes the build flags for the clang
debug target that used to be shared with gcc and incorrectly use
"-ggdb".


# 8667:62372a8d4ef2 09-Jan-2012 Dam Sunwoo <dam.sunwoo@arm.com>

stats: fix Vector2d to display stats correctly when y_subname is not specified.

Vector2d stats with no y_subname were not displayed as the VectorPrint subname was not initialized correctly to reflect the empty field.


# 8666:97d873b8b13e 09-Jan-2012 Prakash Ramrakhyani <Prakash.Ramrakhyani@arm.com>

sim: Enable sampling of run-time for code-sections marked using pseudo insts.

This patch adds a mechanism to collect run time samples for specific portions
of a benchmark, using work_begin and work_end pseudo instructions.It also enhances
the histogram stat to report geometric mean.


# 8634:8390f2d80227 01-Dec-2011 Chris Emmons <chris.emmons@arm.com>

Output: Add hierarchical output support and cleanup existing codebase.


# 8514:57c96df312a1 19-Aug-2011 Thomas Grass <Thomas.Grass@ARM.com>

Stats: Add a sparse histogram stat object.


# 8296:be7f03723412 12-May-2011 Nathan Binkert <nate@binkert.org>

stats: move code that loops over all stats into python


# 8243:63e849f0f341 20-Apr-2011 Brad Danofsky <bradley.danofsky@amd.com>

stats: add user settable separator string for arrayed stats

Default is '::', so no visible change unless it is overridden


# 8230:845c8eb5ac49 15-Apr-2011 Nathan Binkert <nate@binkert.org>

includes: fix up code after sorting


# 8229:78bf55f23338 15-Apr-2011 Nathan Binkert <nate@binkert.org>

includes: sort all includes


# 7831:c1e158414648 10-Jan-2011 Nathan Binkert <nate@binkert.org>

stats: Add a histogram statistic type


# 7811:a8fc35183c10 03-Jan-2011 Steve Reinhardt <steve.reinhardt@amd.com>

Make commenting on close namespace brackets consistent.

Ran all the source files through 'perl -pi' with this script:

s|\s*(};?\s*)?/\*\s*(end\s*)?namespace\s*(\S+)\s*\*/(\s*})?|} // namespace $3|;
s|\s*};?\s*//\s*(end\s*)?namespace\s*(\S+)\s*|} // namespace $2\n|;
s|\s*};?\s*//\s*(\S+)\s*namespace\s*|} // namespace $1\n|;

Also did a little manual editing on some of the arch/*/isa_traits.hh files
and src/SConscript.


# 7505:7772a8bf76ee 21-Jul-2010 Nathan Binkert <nate@binkert.org>

stats: unify the two stats distribution type better


# 7504:ad631c296c9b 21-Jul-2010 Nathan Binkert <nate@binkert.org>

stats: cleanup a few small problems in stats


# 7462:0c61c3cf7639 15-Jun-2010 Nathan Binkert <nate@binkert.org>

stats: rename print to display so it work in python


# 7444:669c1d2df752 03-Jun-2010 Lisa Hsu <Lisa.Hsu@amd.com>

Stats: fix dist stat and enable VectorDistStat


# 6212:64c3b989238c 13-May-2009 Nathan Binkert <nate@binkert.org>

stats: fancy is a bad name


# 6211:40e5a315bded 13-May-2009 Nathan Binkert <nate@binkert.org>

stats: clean up the code for printing stats


# 6130:0fb959250892 22-Apr-2009 Nathan Binkert <nate@binkert.org>

stats: Move flags into info.hh and use base/flags.hh to manage the flags


# 6129:05405c5b8c16 22-Apr-2009 Nathan Binkert <nate@binkert.org>

stats: Shuffle around info stuff so it can be accessed separately


# 6128:fdfbd4c6e449 22-Apr-2009 Nathan Binkert <nate@binkert.org>

stats: Rename the info classes to hopefully make things a bit clearer
FooInfoBase became FooInfo
FooInfo became FooInfoProxy


# 6126:5f32f9e3c65a 22-Apr-2009 Nathan Binkert <nate@binkert.org>

stats: remove simplescalar compatibility for printing


# 6125:3bbbdd324a60 22-Apr-2009 Nathan Binkert <nate@binkert.org>

stats: fix initialization bug in distribution text output


# 6004:97660425ff39 07-Mar-2009 Nathan Binkert <nate@binkert.org>

stats: cleanup text output stuff and fix mysql output


# 5997:471090ec173e 05-Mar-2009 Nathan Binkert <nate@binkert.org>

stats: stick the distribution's fancy parameter into the parameters structure.


# 5889:02e5bc7ca9ba 23-Feb-2009 Nathan Binkert <nate@binkert.org>

stats: reorganize how parameters are stored and accessed.


# 5887:6b312cafaa59 23-Feb-2009 Nathan Binkert <nate@binkert.org>

stats: get rid of the convoluted 'database' code.
Just use the stuff directly and things ought to be more clear


# 5886:12431dc9a30a 23-Feb-2009 Nathan Binkert <nate@binkert.org>

stats: Try to make the names of things more intuitive.
Basically, this means renaming several things called data to info, which
is information about the statistics. Things that are named data now are
actual data stored for the statistic.


# 5884:cba4b5495d7b 23-Feb-2009 Nathan Binkert <nate@binkert.org>

stats: fix text printout for distributions


# 5599:5bad83cddb8c 09-Oct-2008 Nathan Binkert <nate@binkert.org>

stats: use properly signed types for looping and comparison


# 5598:345ef3bda3d2 09-Oct-2008 Nathan Binkert <nate@binkert.org>

style: Bring statistics code in line with the proper style.


# 5581:5e1863e9afa2 02-Oct-2008 Ali Saidi <saidi@eecs.umich.edu>

Output: Verify output files are open after opening them.


# 5570:13592d41f290 28-Sep-2008 Nathan Binkert <nate@binkert.org>

gcc: Add extra parens to quell warnings.
Even though we're not incorrect about operator precedence, let's add
some parens in some particularly confusing places to placate GCC 4.3
so that we don't have to turn the warning off. Agreed that this is a
bit of a pain for those users who get the order of operations correct,
but it is likely to prevent bugs in certain cases.


# 4209:57ff8c2ae0cf 12-Mar-2007 Ali Saidi <saidi@eecs.umich.edu>

Get rid of those pesky valgrind warnings, Conditional jump or move depends on uninitialised value(s), in the stats package


# 4078:3f73f808bbd4 18-Feb-2007 Nathan Binkert <binkertn@umich.edu>

Get rid of the Statistics and Statreset ParamContexts, and
expose all of the relevant functionality to python. Clean
up the mysql code while we're at it.


# 3918:1f9a98d198e8 26-Jan-2007 Ali Saidi <saidi@eecs.umich.edu>

make our code a little more standards compliant
pretty close to compiling w/ suns compiler

briefly:
add dummy return after panic()/fatal()
split out flags by compiler vendor
include cstring and cmath where appropriate
use std namespace for string ops

SConstruct:
Add code to detect compiler and choose cflags based on detected compiler
Fix zlib check to work with suncc
src/SConscript:
split out flags by compiler vendor
src/arch/sparc/isa/decoder.isa:
use correct namespace for sqrt
src/arch/sparc/isa/formats/basic.isa:
add dummy return around panic
src/arch/sparc/isa/formats/integerop.isa:
use correct namespace for stringops
src/arch/sparc/isa/includes.isa:
include cstring and cmath where appropriate
src/arch/sparc/isa_traits.hh:
remove dangling comma
src/arch/sparc/system.cc:
dummy return to make sun cc front end happy
src/arch/sparc/tlb.cc:
src/base/compression/lzss_compression.cc:
use std namespace for string ops
src/arch/sparc/utility.hh:
no reason to say something is unsigned unsigned int
src/base/compression/null_compression.hh:
dummy returns to for suncc front end
src/base/cprintf.hh:
use standard variadic argument syntax instead of gnuc specefic renaming
src/base/hashmap.hh:
don't need to define hash for suncc
src/base/hostinfo.cc:
need stdio.h for sprintf
src/base/loader/object_file.cc:
munmap is in std namespace not null
src/base/misc.hh:
use M5 generic noreturn macros
use standard variadic macro __VA_ARGS__
src/base/pollevent.cc:
we need file.h for file flags
src/base/random.cc:
mess with include files to make suncc happy
src/base/remote_gdb.cc:
malloc memory for function instead of having a non-constant in an array size
src/base/statistics.hh:
use std namespace for floor
src/base/stats/text.cc:
include math.h for rint (cmath won't work)
src/base/time.cc:
use suncc version of ctime_r
src/base/time.hh:
change macro to work with both gcc and suncc
src/base/timebuf.hh:
include cstring from memset and use std::
src/base/trace.hh:
change variadic macros to be normal format
src/cpu/SConscript:
add dummy returns where appropriate
src/cpu/activity.cc:
include cstring for memset
src/cpu/exetrace.hh:
include cstring fro memcpy
src/cpu/simple/base.hh:
add dummy return for panic
src/dev/baddev.cc:
src/dev/pciconfigall.cc:
src/dev/platform.cc:
src/dev/sparc/t1000.cc:
add dummy return where appropriate
src/dev/ide_atareg.h:
make define work for both gnuc and suncc
src/dev/io_device.hh:
add dummy returns where approirate
src/dev/pcidev.hh:
src/mem/cache/cache_impl.hh:
src/mem/cache/miss/blocking_buffer.cc:
src/mem/cache/tags/lru.hh:
src/mem/cache/tags/split.hh:
src/mem/cache/tags/split_lifo.hh:
src/mem/cache/tags/split_lru.hh:
src/mem/dram.cc:
src/mem/packet.cc:
src/mem/port.cc:
include cstring for string ops
src/dev/sparc/mm_disk.cc:
add dummy return where appropriate
include cstring for string ops
src/mem/cache/miss/blocking_buffer.hh:
src/mem/port.hh:
Add dummy return where appropriate
src/mem/cache/tags/iic.cc:
cast hastSets to double for log() call
src/mem/physical.cc:
cast pmemAddr to char* for munmap
src/sim/byteswap.hh:
make define work for suncc and gnuc


# 2716:b9114064d77a 11-Jun-2006 Nathan Binkert <binkertn@umich.edu>

Merge iceaxe.:/Volumes/work/research/m5/head
into iceaxe.:/Volumes/work/research/m5/merge

src/cpu/simple/base.cc:
src/kern/kernel_stats.cc:
src/kern/kernel_stats.hh:
src/kern/system_events.cc:
src/kern/system_events.hh:
src/python/m5/objects/System.py:
src/sim/system.cc:
src/sim/system.hh:
hand merge


# 2665:a124942bacb8 31-May-2006 Ali Saidi <saidi@eecs.umich.edu>

Updated Authors from bk prs info


# 2632:1bb2f91485ea 22-May-2006 Steve Reinhardt <stever@eecs.umich.edu>

New directory structure:
- simulator source now in 'src' subdirectory
- imported files from 'ext' repository
- support building in arbitrary places, including
outside of the source tree. See comment at top
of SConstruct file for more details.
Regression tests are temporarily disabled; that
syetem needs more extensive revisions.

SConstruct:
Update for new directory structure.
Modify to support build trees that are not subdirectories
of the source tree. See comment at top of file for
more details.
Regression tests are temporarily disabled.
src/arch/SConscript:
src/arch/isa_parser.py:
src/python/SConscript:
Update for new directory structure.