blob: 668e9439123a817d3c206497b4ebf857fe284845 [file] [log] [blame]
Mike Dodd8cfa7022010-11-17 11:12:26 -08001/**
2 * @file xml_utils.h
3 * utility routines for generating XML
4 *
5 * @remark Copyright 2006 OProfile authors
6 * @remark Read the file COPYING
7 *
8 * @author Dave Nomura
9 */
10
11#ifndef XML_UTILS_H
12#define XML_UTILS_H
13
14#include "symbol.h"
15#include "format_output.h"
16#include "xml_output.h"
17
18typedef symbol_collection::const_iterator sym_iterator;
19extern bool want_xml;
20
21class extra_images;
22class op_bfd;
23
24class xml_utils {
25public:
26 xml_utils(format_output::xml_formatter * xo,
27 symbol_collection const & s, size_t nc,
28 extra_images const & extra);
29 // these members are static because they are invoked before
30 // the xml_utils object has been created
31 static std::string get_timer_setup(size_t count);
32 static std::string get_event_setup(std::string event, size_t count,
33 std::string unit_mask);
34 static std::string get_profile_header(std::string cpu_name,
35 double const speed);
36 static void set_nr_cpus(size_t cpus);
37 static void set_nr_events(size_t events);
38 static void set_has_nonzero_masks();
39 static void add_option(tag_t tag, bool value);
40 static void add_option(tag_t tag, std::string const & value);
41 static void add_option(tag_t tag, std::vector<std::string> const & value);
42 static void add_option(tag_t tag, std::list<std::string> const & value);
43
44 static void output_xml_header(std::string const & command_options,
45 std::string const & cpu_info,
46 std::string const & events);
47 void output_symbol_bytes(std::ostream & out, symbol_entry const * symb,
48 size_t sym_id, op_bfd const & abfd);
49 bool output_summary_data(std::ostream & out, count_array_t const & summary,
50 size_t pclass);
51 size_t get_symbol_index(sym_iterator const it);
52 void output_program_structure(std::ostream & out);
53 void build_subclasses(std::ostream & out);
54private:
55 bool multiple_events;
56 bool has_subclasses;
57 size_t bytes_index;
58 extra_images const & extra_found_images;
59 static bool has_nonzero_masks;
60 static size_t events_index;
61};
62
63extern xml_utils * xml_support;
64
65#endif /* !XML_UTILS_H */