SENF Extensible Network Framework
Home
Overview
Examples
HowTos
Glossary
Ext
NetEmu
PPI
Packets
Scheduler
Socket
Utils
Console
Daemon
Logger
Termlib
CpuStat.hh
Go to the documentation of this file.
1
//
2
// Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3
// Network Research Group (NET)
4
// Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5
// Contact: support@wiback.org
6
//
7
// This file is part of the SENF code tree.
8
// It is licensed under the 3-clause BSD License (aka New BSD License).
9
// See LICENSE.txt in the top level directory for details or visit
10
// https://opensource.org/licenses/BSD-3-Clause
11
//
12
13
17
#ifndef HH_SENF_Utils_CpuStat_
18
#define HH_SENF_Utils_CpuStat_ 1
19
20
// Custom includes
21
#include <list>
22
#include <
senf/Utils/singleton.hh
>
23
#include <
senf/Scheduler/ClockService.hh
>
24
25
//-/////////////////////////////////////////////////////////////////////////////////////////////////
26
namespace
senf
{
27
28
struct
CpuStat
29
{
30
ClockService::clock_type
duration
;
31
unsigned
user
;
32
unsigned
system
;
33
unsigned
nice
;
34
unsigned
idle
;
35
unsigned
iowait
;
36
unsigned
irq
;
37
unsigned
softirq
;
38
unsigned
steal
;
39
unsigned
guest
;
40
41
CpuStat
(
ClockService::clock_type
duration =
ClockService::milliseconds
( 0),
42
unsigned
user=0,
43
unsigned
system=0,
44
unsigned
nice=0,
45
unsigned
idle=0,
46
unsigned
iowait=0,
47
unsigned
irq=0,
48
unsigned
softirq=0,
49
unsigned
steal=0,
50
unsigned
guest=0);
51
};
52
53
class
CpuStatProb
54
{
55
public
:
56
CpuStat
cpuStat();
57
58
private
:
59
typedef
std::vector<boost::long_long_type> CpuStatProbs;
60
CpuStatProbs probs;
61
ClockService::clock_type
time;
62
};
63
64
65
class
CpuStatConsole
66
{
67
public
:
68
CpuStatConsole
();
69
void
dump
(std::ostream & os);
70
71
private
:
72
CpuStatProb
procStats_;
73
};
74
75
std::ostream &
operator<<
(std::ostream & os,
CpuStat
const
& cs);
76
77
}
78
79
//-/////////////////////////////////////////////////////////////////////////////////////////////////
80
//#include "CpuStat.cci"
81
//#include "CpuStat.ct"
82
//#include "CpuStat.cti"
83
#endif
senf::ClockService::clock_type
config::time_type clock_type
senf::CpuStat::idle
unsigned idle
Definition:
CpuStat.hh:34
senf::CpuStat::steal
unsigned steal
Definition:
CpuStat.hh:38
senf::CpuStat::system
unsigned system
Definition:
CpuStat.hh:32
senf
Definition:
algorithm.hh:27
senf::ClockService::milliseconds
static SENF_CLOCKSERVICE_CONSTEXPR clock_type milliseconds(int64_type const &v)
dump
void dump(std::ostream &os, DirectoryNode &dir=root())
senf::CpuStat::softirq
unsigned softirq
Definition:
CpuStat.hh:37
senf::operator<<
std::ostream & operator<<(std::ostream &os, CpuStat const &cs)
Definition:
CpuStat.cc:103
senf::CpuStatConsole
Definition:
CpuStat.hh:65
senf::CpuStat
Definition:
CpuStat.hh:28
senf::CpuStat::user
unsigned user
Definition:
CpuStat.hh:31
singleton.hh
singleton public header
senf::CpuStat::iowait
unsigned iowait
Definition:
CpuStat.hh:35
senf::CpuStat::CpuStat
CpuStat(ClockService::clock_type duration=ClockService::milliseconds(0), unsigned user=0, unsigned system=0, unsigned nice=0, unsigned idle=0, unsigned iowait=0, unsigned irq=0, unsigned softirq=0, unsigned steal=0, unsigned guest=0)
Definition:
CpuStat.cc:28
ClockService.hh
senf::CpuStat::guest
unsigned guest
Definition:
CpuStat.hh:39
senf::CpuStat::duration
ClockService::clock_type duration
Definition:
CpuStat.hh:30
senf::CpuStatProb
Definition:
CpuStat.hh:53
senf::CpuStat::irq
unsigned irq
Definition:
CpuStat.hh:36
senf::CpuStat::nice
unsigned nice
Definition:
CpuStat.hh:33