Automatic date update in version.in
[binutils-gdb.git] / gprofng / src / IndexObject.h
blob23f21d364818049c962df459eb1d9b64dd2e6f98
1 /* Copyright (C) 2021 Free Software Foundation, Inc.
2 Contributed by Oracle.
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)
9 any later version.
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. */
21 #ifndef _INDEXOBJECT_H
22 #define _INDEXOBJECT_H
24 #include "Histable.h"
25 #include "Expression.h"
27 class IndexObject : public Histable
29 public:
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
34 virtual Histable_type
35 get_type ()
37 return INDEXOBJ;
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);
45 virtual uint64_t
46 get_addr ()
48 return id;
51 uint64_t
52 get_index ()
54 return id;
57 Histable *
58 get_obj ()
60 return obj;
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);
74 private:
76 int indextype;
77 Histable *obj;
78 bool nameIsFinal;
81 typedef enum IndexObjTypes
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;
95 class IndexObjType_t
97 public:
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;
111 #endif /* _INDEXOBJECT_H */