1 /* Copyright (C) 2021 Free Software Foundation, Inc.
4 This file is part of GNU Binutils.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, 51 Franklin Street - Fifth Floor, Boston,
19 MA 02110-1301, USA. */
24 #include "dbe_structs.h"
27 #include "BaseMetric.h"
33 // The metric class defines the metrics that are available. The metrics are
34 // registered when the experiment's log file is read.
35 class Metric
: public BaseMetric
39 typedef struct HistMetricS
44 char legend1
[MAX_LEN
];
45 char legend2
[MAX_LEN
];
46 char legend3
[MAX_LEN
];
47 int indFirstExp
; // only for -compare=[delta|ratio]
48 int indTimeVal
; // only for HWC time-converted metrics
49 void update_max (struct HistMetricS
*hm
);
53 Metric (const Metric
& item
); // copy constructor
54 Metric (BaseMetric
*item
, SubType st
);
55 Metric (char *_name
, SubType st
); // for derived metrics
58 char *get_mcmd (bool); // e.user, a.total, etc. NOTI18N
59 int get_real_visbits (); // methods for managing visibility
60 ValueTag
get_vtype2 (); // takes comparison visbits into account
61 void set_dmetrics_visbits (int _dmetrics_visbits
);
63 // fetch various fields from a Metric
101 set_raw_visbits (int _visbits
)
113 enable_all_visbits ()
115 visbits
= get_value_styles ();
119 #define VAL_IS_HIDDEN(n) ((n) == -1 || (n) == VAL_NA || ((n) & VAL_HIDE_ALL) != 0)
124 return !VAL_IS_HIDDEN (visbits
)
125 && (visbits
& (VAL_VALUE
| VAL_TIMEVAL
| VAL_PERCENT
));
131 return (visbits
& VAL_VALUE
) != 0
132 || (!is_time_val () && (visbits
& VAL_TIMEVAL
) != 0);
138 return is_time_val () && (visbits
& VAL_TIMEVAL
) != 0;
144 return !VAL_IS_HIDDEN (visbits
) && is_value_visible ();
150 return !VAL_IS_HIDDEN (visbits
) && is_time_visible ();
156 return !VAL_IS_HIDDEN (visbits
) && (visbits
& VAL_PERCENT
) != 0;
162 int v
= VAL_TIMEVAL
| VAL_VALUE
;
163 return (get_value_styles () & v
) == v
;
166 // per-bit handling of visbits
167 // Note: Forces VAL_HIDE_ALL to zero. Use only on temporary Metric objects.
168 void set_vvisible (bool set
);
169 void set_tvisible (bool set
);
170 void set_pvisible (bool set
);
172 void set_subtype (SubType st
);
173 void legend_width (HistMetric
*hitem
, int gap
);
174 char *get_vis_str ();
175 char *get_vis_string (int vis
);
180 BaseMetric
*baseMetric
;
181 SubType subtype
; // specific variant for this Metric
185 int visbits
; // ValueType, e.g. VAL_VALUE|VAL_TIMEVAL
188 #endif /* _METRIC_H */