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"
28 #include "DerivedMetrics.h"
32 // The MetricList class is used to manage a list of metrics
38 MetricList (Vector<BaseMetric*> *base_metrics, MetricType type);
39 MetricList (MetricList *old);
40 MetricList (MetricType _mtype);
43 // Methods concerning a list of metrics
44 // set metrics -- text, caller-callee, data, and index flavors
45 // flavor depends on mtype in the list
46 // returns NULL if OK, or an error string if not
47 // always returns NULL if fromRcFile is TRUE
48 char *set_metrics (const char *metric_cmd, bool fromRcFile, DerivedMetrics *derived_metrics);
50 // update the caller-callee or dataspace metrics to match normal metrics
51 // It is assumed that this->mtype is MET_CALL, MET_DATA, or MET_INDX and
52 // that metrics_list->mtype is MET_NORMAL
53 void set_metrics (MetricList *metrics_list);
55 // produce a string for the metrics from a vector
58 // set the sort metric for a list from a metric string
59 // returns NULL if OK, or an error string if not
60 char *set_sort (const char *metric_cmd, bool fromRcFile);
62 // set the sort metric for a list from the first visible index
63 void set_fallback_sort ();
65 // set the sort metric for a list from a visible index
66 void set_sort (int visindex, bool reverse);
68 char *get_sort_name (); // get the name of the sort metric from a vector
71 get_sort_rev () // get the boolean reverse for the sort metric
85 return sort_ref_index;
89 set_sort_ref_index (int ind)
94 bool set_sort_metric (char *metric_cmd, BaseMetric::SubType mst, bool reverse);
95 Metric *find_metric (char *cmd, BaseMetric::SubType st);
96 Metric *find_metric_by_name (char *cmd);
97 int get_listorder (char *cmd, BaseMetric::SubType st, const char *expr = NULL);
98 int get_listorder (Metric *mtr);
99 Metric *get_sort_metric (); // get the sort metric from a vector
100 char *get_sort_cmd (); // get the command name of the sort metric
109 get_items () // get the vector of metrics from the list
117 return items->get (i);
121 put (long i, Metric *m)
135 return items ? items->size () : 0;
138 Metric *append (BaseMetric *bm, BaseMetric::SubType st, int visbits);
140 // produce a list of all metrics from a vector
141 void print_metric_list (FILE *dis_file, char *leader, int debug);
143 // Add any and all matching metrics to the growing list
144 // return value is zero for OK, 1 for no match
145 int add_matching_dmetrics (Vector<BaseMetric*> *base_items, char *cmd,
146 BaseMetric::SubType *subtypes, int nsubtypes,
147 int dmetrics_vis, // literal translation of dmetrics +. etc.
151 // parse a metric specification substring, based on type of list
152 char *parse_metric_spec (char *cmd, BaseMetric::SubType *subtypes,
153 int *nsubtypes, int *dmetrics_visb, bool *isOK);
155 Vector<Metric*> *items;
158 // the sort reference index
163 #endif /* _METRICLIST_H */