areaDetector  3-5-0
EPICS areaDetector framework
cpu_measure.h
Go to the documentation of this file.
1 //=============================================================================
2 // Copyright 2017 FLIR Integrated Imaging Solutions, Inc. All Rights Reserved.
3 //
4 // This software is the confidential and proprietary information of FLIR
5 // Integrated Imaging Solutions, Inc. ("Confidential Information"). You
6 // shall not disclose such Confidential Information and shall use it only in
7 // accordance with the terms of the license agreement you entered into
8 // with FLIR Integrated Imaging Solutions, Inc. (FLIR).
9 //
10 // FLIR MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
11 // SOFTWARE, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
12 // IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
13 // PURPOSE, OR NON-INFRINGEMENT. FLIR SHALL NOT BE LIABLE FOR ANY DAMAGES
14 // SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
15 // THIS SOFTWARE OR ITS DERIVATIVES.
16 //=============================================================================
17 
18 #pragma once
19 
20 #include <sys/types.h>
21 #include <unistd.h>
22 
23 
25 {
26 public:
27 
28  CpuMeasure();
29  ~CpuMeasure();
30 
31  bool Start();
32  bool Stop();
33 
34  float GetCPUTime();
35  float GetUserTime();
36  float GetKernelTime();
37 
38  float GetGlobalUserTime();
39  float GetGlobalKernelTime();
40 
41 private:
42 
43  pid_t m_process_id;
44  unsigned int m_num_cpus;
45 
46  unsigned long m_user_cpu_time_process_start;
47  unsigned long m_kernel_cpu_time_process_start;
48  unsigned long m_user_cpu_time_process_stop;
49  unsigned long m_kernel_cpu_time_process_stop;
50 
51  unsigned long long m_user_cpu_time_system_start;
52  unsigned long long m_kernel_cpu_time_system_start;
53  unsigned long long m_user_cpu_time_system_stop;
54  unsigned long long m_kernel_cpu_time_system_stop;
55 
56  unsigned long long m_nice_cpu_time_system_start;
57  unsigned long long m_idle_cpu_time_system_start;
58  unsigned long long m_nice_cpu_time_system_stop;
59  unsigned long long m_idle_cpu_time_system_stop;
60 
61  unsigned long long m_system_wide_user_start;
62  unsigned long long m_system_wide_user_stop;
63 };
float GetUserTime()
Definition: cpu_measure.cpp:110
float GetCPUTime()
Definition: cpu_measure.cpp:97
Definition: cpu_measure.h:24
float GetKernelTime()
Definition: cpu_measure.cpp:120
float GetGlobalUserTime()
Definition: cpu_measure.cpp:130
bool Start()
Definition: cpu_measure.cpp:35
bool Stop()
Definition: cpu_measure.cpp:66
float GetGlobalKernelTime()
Definition: cpu_measure.cpp:138
CpuMeasure()
Definition: cpu_measure.cpp:21
~CpuMeasure()
Definition: cpu_measure.cpp:30