diff options
author | Vladimir Mezentsev <vladimir.mezentsev@oracle.com> | 2022-03-11 08:58:31 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2022-03-11 08:58:31 +0000 |
commit | bb368aad297fe3ad40cf397e6fc85aa471429a28 (patch) | |
tree | 0ab25909b8fe789d676bbdb00d501d4d485e4afe /gprofng/src/Metric.h | |
parent | a655f19af95eb685ba64f48ee8fc2b3b7a3d886a (diff) | |
download | gdb-bb368aad297fe3ad40cf397e6fc85aa471429a28.zip gdb-bb368aad297fe3ad40cf397e6fc85aa471429a28.tar.gz gdb-bb368aad297fe3ad40cf397e6fc85aa471429a28.tar.bz2 |
gprofng: a new GNU profiler
top-level
* Makefile.def: Add gprofng module.
* configure.ac: Add --enable-gprofng option.
* src-release.sh: Add gprofng.
* Makefile.in: Regenerate.
* configure: Regenerate.
* gprofng: New directory.
binutils
* MAINTAINERS: Add gprofng maintainer.
* README-how-to-make-a-release: Add gprofng.
include.
* collectorAPI.h: New file.
* libcollector.h: New file.
* libfcollector.h: New file.
Diffstat (limited to 'gprofng/src/Metric.h')
-rw-r--r-- | gprofng/src/Metric.h | 188 |
1 files changed, 188 insertions, 0 deletions
diff --git a/gprofng/src/Metric.h b/gprofng/src/Metric.h new file mode 100644 index 0000000..a2b3778 --- /dev/null +++ b/gprofng/src/Metric.h @@ -0,0 +1,188 @@ +/* Copyright (C) 2021 Free Software Foundation, Inc. + Contributed by Oracle. + + This file is part of GNU Binutils. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + +#ifndef _METRIC_H +#define _METRIC_H + +#include "dbe_structs.h" +#include "vec.h" +#include "enums.h" +#include "BaseMetric.h" + +#define MAX_LEN 1024 + +class Expression; + +// The metric class defines the metrics that are available. The metrics are +// registered when the experiment's log file is read. +class Metric : public BaseMetric +{ +public: + + typedef struct HistMetricS + { + int width; + int maxvalue_width; + int maxtime_width; + char legend1[MAX_LEN]; + char legend2[MAX_LEN]; + char legend3[MAX_LEN]; + int indFirstExp; // only for -compare=[delta|ratio] + int indTimeVal; // only for HWC time-converted metrics + void update_max (struct HistMetricS *hm); + void init (); + } HistMetric; + + Metric (const Metric& item); // copy constructor + Metric (BaseMetric *item, SubType st); + Metric (char *_name, SubType st); // for derived metrics + virtual ~Metric (); + + char *get_mcmd (bool); // e.user, a.total, etc. NOTI18N + int get_real_visbits (); // methods for managing visibility + ValueTag get_vtype2 (); // takes comparison visbits into account + void set_dmetrics_visbits (int _dmetrics_visbits); + + // fetch various fields from a Metric + SubType + get_subtype () + { + return subtype; + } + + char * + get_name () + { + return name; + } + + char * + get_abbr () + { + return abbr; + } + + char * + get_abbr_unit () + { + return abbr_unit; + } + + BaseMetric * + get_base_metric () + { + return baseMetric; + } + + int + get_visbits () + { + return visbits; + } + + void + set_raw_visbits (int _visbits) + { + visbits = _visbits; + } + + void + clear_all_visbits () + { + visbits = VAL_NA; + } + + void + enable_all_visbits () + { + visbits = get_value_styles (); + } + + +#define VAL_IS_HIDDEN(n) ((n) == -1 || (n) == VAL_NA || ((n) & VAL_HIDE_ALL) != 0) + + bool + is_any_visible () + { + return !VAL_IS_HIDDEN (visbits) + && (visbits & (VAL_VALUE | VAL_TIMEVAL | VAL_PERCENT)); + } + + bool + is_value_visible () + { + return (visbits & VAL_VALUE) != 0 + || (!is_time_val () && (visbits & VAL_TIMEVAL) != 0); + } + + bool + is_time_visible () + { + return is_time_val () && (visbits & VAL_TIMEVAL) != 0; + } + + bool + is_visible () + { + return !VAL_IS_HIDDEN (visbits) && is_value_visible (); + } + + bool + is_tvisible () + { + return !VAL_IS_HIDDEN (visbits) && is_time_visible (); + } + + bool + is_pvisible () + { + return !VAL_IS_HIDDEN (visbits) && (visbits & VAL_PERCENT) != 0; + } + + bool + is_time_val () + { + int v = VAL_TIMEVAL | VAL_VALUE; + return (get_value_styles () & v) == v; + } + + // per-bit handling of visbits + // Note: Forces VAL_HIDE_ALL to zero. Use only on temporary Metric objects. + void set_vvisible (bool set); + void set_tvisible (bool set); + void set_pvisible (bool set); + + void set_subtype (SubType st); + void legend_width (HistMetric *hitem, int gap); + char *get_vis_str (); + char *get_vis_string (int vis); + char *dump (); + + +private: + BaseMetric *baseMetric; + SubType subtype; // specific variant for this Metric + char *name; + char *abbr; + char *abbr_unit; + int visbits; // ValueType, e.g. VAL_VALUE|VAL_TIMEVAL +}; + +#endif /* _METRIC_H */ |