]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gprofng/src/IndexObject.h
Update year range in gprofng copyright notices
[thirdparty/binutils-gdb.git] / gprofng / src / IndexObject.h
CommitLineData
76bdc726 1/* Copyright (C) 2021-2023 Free Software Foundation, Inc.
bb368aad
VM
2 Contributed by Oracle.
3
4 This file is part of GNU Binutils.
5
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)
9 any later version.
10
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.
15
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. */
20
21#ifndef _INDEXOBJECT_H
22#define _INDEXOBJECT_H
23
24#include "Histable.h"
25#include "Expression.h"
26
27class IndexObject : public Histable
28{
29public:
30 IndexObject (int _indextype, uint64_t _index);
31 IndexObject (int _indextype, Histable *_obj);
32 bool requires_string_sort (); // name column should be sorted using name text
33
34 virtual Histable_type
35 get_type ()
36 {
37 return INDEXOBJ;
38 }
39
40 virtual char *get_name (NameFormat = NA);
41 virtual void set_name (char*);
42 virtual void set_name_from_context (Expression::Context *);
43 virtual Histable *convertto (Histable_type, Histable* = NULL);
44
45 virtual uint64_t
46 get_addr ()
47 {
48 return id;
49 }
50
51 uint64_t
52 get_index ()
53 {
54 return id;
55 }
56
57 Histable *
58 get_obj ()
59 {
60 return obj;
61 }
62
63 // for use in index object definitions
64 static const uint64_t INDXOBJ_EXPGRID_SHIFT = 60;
65 static const uint64_t INDXOBJ_EXPID_SHIFT = 32;
66 static const uint64_t INDXOBJ_PAYLOAD_SHIFT = 0;
67 static const uint64_t INDXOBJ_EXPGRID_MASK =
68 ((1LLU << (64 - INDXOBJ_EXPGRID_SHIFT)) - 1);
69 static const uint64_t INDXOBJ_EXPID_MASK =
70 ((1LLU << (INDXOBJ_EXPGRID_SHIFT - INDXOBJ_EXPID_SHIFT)) - 1);
71 static const uint64_t INDXOBJ_PAYLOAD_MASK =
72 ((1LLU << (INDXOBJ_EXPID_SHIFT - INDXOBJ_PAYLOAD_SHIFT)) - 1);
73
74private:
75
76 int indextype;
77 Histable *obj;
78 bool nameIsFinal;
79};
80
81typedef enum IndexObjTypes
82{
83 INDEX_THREADS = 0,
84 INDEX_CPUS,
85 INDEX_SAMPLES,
86 INDEX_GCEVENTS,
87 INDEX_SECONDS,
88 INDEX_PROCESSES,
89 INDEX_EXPERIMENTS,
90 INDEX_BYTES,
91 INDEX_DURATION,
92 INDEX_LAST // never used; marks the count of precompiled items
93} IndexObjTypes_t;
94
95class IndexObjType_t
96{
97public:
98 IndexObjType_t ();
99 ~IndexObjType_t ();
100 int type;
101 char *name; // used as input
102 char *i18n_name; // used for output
103 char *index_expr_str;
104 Expression *index_expr;
105 char mnemonic;
106 char *short_description;
107 char *long_description;
108 MemObjType_t *memObj;
109};
110
111#endif /* _INDEXOBJECT_H */