The Pedigree Project
0.1
src
system
include
pedigree
kernel
LatencyAccounting.h
1
/* Copyright (c) 2026, Pedigree Developers. */
2
#ifndef PEDIGREE_KERNEL_LATENCYACCOUNTING_H
3
#define PEDIGREE_KERNEL_LATENCYACCOUNTING_H
4
5
#include "pedigree/kernel/compiler.h"
6
7
#include <config.h>
8
#include <stddef.h>
9
#include <stdint.h>
10
11
namespace
LatencyAccounting {
12
enum
Field :
size_t
{
13
OnlineSince,
14
IrqOffNanoseconds,
15
IrqOffCount,
16
IrqOffMax,
17
IrqOffMaxEnd,
18
IrqOffMaxSite,
19
IrqOffOver1ms,
20
IrqOffOver10ms,
21
IrqOffOpenSince,
22
IrqOffOpenSite,
23
DeferredCpuNanoseconds,
24
DeferredWallNanoseconds,
25
DeferredCount,
26
DeferredMax,
27
Count,
28
};
29
30
struct
Snapshot
{
31
uint64_t values[Count] = {};
32
};
33
34
#if PEDIGREE_LATENCY_ACCOUNTING
35
// Local writers run with IRQs masked. CPU contributions also accept NMI entry.
36
void
armCpu();
37
bool
active();
38
void
recordDeferredCpu(uint64_t elapsed);
39
void
recordDeferredWall(uint64_t elapsed);
40
EXPORTED_PUBLIC
bool
snapshot(
size_t
cpu,
Snapshot
& result);
41
#else
42
inline
void
armCpu() {}
43
inline
bool
snapshot(
size_t
, Snapshot&) {
44
return
false
;
45
}
46
#endif
47
}
// namespace LatencyAccounting
48
49
#if PEDIGREE_LATENCY_ACCOUNTING
50
// Called before enabling IRQs or after masking them, with kernel GS installed.
51
extern
"C"
EXPORTED_PUBLIC
void
pedigree_irq_time_state(
bool
enabled);
52
#endif
53
#endif
LatencyAccounting::Snapshot
Definition
LatencyAccounting.h:30
Generated on Tue Sep 29 2026 04:30:11 for The Pedigree Project by
1.9.8