Debian Codegraph @

src/core/components/cpuutils.h

raw symbols SCIP
1 // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/src/core/components/cpuutils.h`/
2 // Copyright 2019 Juan Palacios <[email protected]>
3
4 #pragma once
5
6 #include <cstdint>
7 #include <optional>
8 #include <string>
9 #include <string_view>
10 #include <vector>
11
12 namespace Utilscxx . . $ Utils/::CPUcxx . . $ Utils/CPU/ {
13
14 /// Returns a piece of information from /proc/cpuinfo.
15 /// @param procCpuInfoLines /proc/cpuinfo data source contents lines
16 /// @param cpuId cpu id from which the info will be retrieved
17 /// @param target label that describes the information to retrieve
18 stdcxx . . $ std/::optionalcxx . . $ std/optional#<stdcxx . . $ std/::stringcxx . . $ std/string#>
19 parseProcCpuInfocxx . . $ Utils/CPU/parseProcCpuInfo(6ce55c29d0623432).(stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> const &procCpuInfoLines, int cpuId,
20 stdcxx . . $ std/::string_viewcxx . . $ std/string_view# target);
21
22 /// CPU Stat captured from /proc/stat.
23 struct Statcxx . . $ Utils/CPU/Stat#
24 {
25 stdcxx . . $ std/::uint64_tcxx . . $ std/uint64_t# usercxx . . $ Utils/CPU/Stat#user.;
26 stdcxx . . $ std/::uint64_tcxx . . $ std/uint64_t# nicecxx . . $ Utils/CPU/Stat#nice.;
27 stdcxx . . $ std/::uint64_tcxx . . $ std/uint64_t# systemcxx . . $ Utils/CPU/Stat#system.;
28 stdcxx . . $ std/::uint64_tcxx . . $ std/uint64_t# idlecxx . . $ Utils/CPU/Stat#idle.;
29 stdcxx . . $ std/::uint64_tcxx . . $ std/uint64_t# ioWaitcxx . . $ Utils/CPU/Stat#ioWait.;
30 stdcxx . . $ std/::uint64_tcxx . . $ std/uint64_t# irqcxx . . $ Utils/CPU/Stat#irq.;
31 stdcxx . . $ std/::uint64_tcxx . . $ std/uint64_t# softIrqcxx . . $ Utils/CPU/Stat#softIrq.;
32 stdcxx . . $ std/::uint64_tcxx . . $ std/uint64_t# stealcxx . . $ Utils/CPU/Stat#steal.;
33 stdcxx . . $ std/::uint64_tcxx . . $ std/uint64_t# totalcxx . . $ Utils/CPU/Stat#total.;
34 };
35
36 /// Returns the aggregate CPU Stat from /proc/stat.
37 /// @param procStatLines /proc/stat data.
38 /// @returns CPU stat or none when the CPU stat cannot be parsed from the input data.
39 stdcxx . . $ std/::optionalcxx . . $ std/optional#<Statcxx . . $ Utils/CPU/Stat#> parseProcStatcxx . . $ Utils/CPU/parseProcStat(c74a6c71ef0cb6d8).(stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> const &procStatLines);
40
41 /// Computes the used CPU in a time interval defined by statT0 and statT1.
42 /// @param statT0 CPU stat captured in time 0.
43 /// @param statT1 CPU stat captured in time 1 (some time after statT0).
44 /// @returns percentage of the CPU used in the time interval.
45 unsigned int computeCPUUsagecxx . . $ Utils/CPU/computeCPUUsage(501d82387ff0e1d5).(Statcxx . . $ Utils/CPU/Stat# const &statT0, Statcxx . . $ Utils/CPU/Stat# const &statT1);
46
47 } // namespace Utils::CPU