xref: /netbsd-src/external/gpl3/binutils/dist/gprofng/src/Sample.h (revision cb63e24e8d6aae7ddac1859a9015f48b1d8bd90e)
1 /* Copyright (C) 2021-2024 Free Software Foundation, Inc.
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 _SAMPLE_H
22 #define _SAMPLE_H
23 
24 // A data Sample object represents a single sample's worth of data.  This
25 // object is private and is only used by Experiment and Sample_sel.
26 
27 #include "dbe_types.h"
28 
29 class PrUsage;
30 
31 class Sample
32 {
33   friend class Experiment; // see post_process(), read_overview_file()
34 public:
35   Sample (int num);
36   ~Sample ();
37   PrUsage *get_usage ();
38 
39   char *
get_start_label()40   get_start_label ()
41   {
42     return start_label;
43   }
44 
45   char *
get_end_label()46   get_end_label ()
47   {
48     return end_label;
49   }
50 
51   hrtime_t
get_start_time()52   get_start_time ()
53   {
54     return start_time;
55   }
56 
57   hrtime_t
get_end_time()58   get_end_time ()
59   {
60     return end_time;
61   }
62 
63   int
get_number()64   get_number ()
65   {
66     return number;
67   }
68 
69 private:
70   void validate_usage ();   // Make sure usage data is consistent
71   bool validated;           // if validation performed
72   char *start_label;        // sample start label
73   char *end_label;          // sample end label
74   hrtime_t start_time;      // sample start time
75   hrtime_t end_time;        // sample end time
76   PrUsage *prusage;         // process usage data
77   int number;               // sample number
78 };
79 
80 #endif /* _SAMPLE_H */
81