GCC Middle and Back End API Reference
bar-chart.h
Go to the documentation of this file.
1/* Support for plotting bar charts in dumps.
2 Copyright (C) 2020-2024 Free Software Foundation, Inc.
3 Contributed by David Malcolm <dmalcolm@redhat.com>.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it
8under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 3, or (at your option)
10any later version.
11
12GCC is distributed in the hope that it will be useful, but
13WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
20
21#ifndef GCC_ANALYZER_BAR_CHART_H
22#define GCC_ANALYZER_BAR_CHART_H
23
24namespace ana {
25
26/* A class for printing bar charts to a pretty_printer.
27
28 TODO(stage1): move to gcc subdir? */
29
31{
32public:
33 typedef unsigned long value_t;
34
35 /* Add an item, taking a copy of NAME. */
36 void add_item (const char *name, value_t value);
37
38 /* Print the data to PP. */
39 void print (pretty_printer *pp) const;
40
41private:
42 struct item
43 {
44 item (const char *name, value_t value)
45 : m_name (xstrdup (name)), m_strlen (strlen (name)) , m_value (value) {}
46 ~item () { free (m_name); }
47
48 char *m_name;
49 size_t m_strlen;
51 };
52
53 static void print_padding (pretty_printer *pp, size_t count);
54
56};
57
58} // namespace ana
59
60#endif /* GCC_ANALYZER_BAR_CHART_H */
Definition bar-chart.h:31
auto_delete_vec< item > m_items
Definition bar-chart.h:55
static void print_padding(pretty_printer *pp, size_t count)
void print(pretty_printer *pp) const
void add_item(const char *name, value_t value)
unsigned long value_t
Definition bar-chart.h:33
Definition vec.h:1802
Definition pretty-print.h:244
static unsigned int count[debug_counter_number_of_counters]
Definition dbgcnt.cc:50
free(str)
T * ggc_alloc(ALONE_CXX_MEM_STAT_INFO)
Definition ggc.h:184
Definition access-diagram.h:30
Definition bar-chart.h:43
size_t m_strlen
Definition bar-chart.h:49
item(const char *name, value_t value)
Definition bar-chart.h:44
~item()
Definition bar-chart.h:46
char * m_name
Definition bar-chart.h:48
value_t m_value
Definition bar-chart.h:50