GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — jonoffcpu/docs/diagrams/offcpu-timeline.d2 at main · jonoffcpu/jonoffcpu

Expand file tree

/

offcpu-timeline.d2

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
105 lines (95 loc) · 3.18 KB
/

offcpu-timeline.d2

Copy path

File metadata and controls

105 lines (95 loc) · 3.18 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# One thread as the Linux scheduler sees it: the states between two runs on a CPU.
# Render from the repository root with
# docs/diagrams/render.sh offcpu-timeline (d2 --layout=tala, output docs/images/)
#
# Layout notes (see architecture.d2 for the full list of TALA rules):
# - A hidden single-row grid pins the three spans in time order; TALA alone would
# stack them. Edges between grid cells are routed straight by d2 (rule 5), which
# is what a timeline wants.
# - The off-CPU interval is a one-row grid around the two off-CPU states; that is what
# draws the bracket and keeps Blocked left of Runnable. The on-CPU states are plain
# boxes so the whole row stays narrow enough to read at page width.
# - Preemption (Running -> Runnable without sleeping) is a note under the timeline
# rather than an edge: a straight edge across the Blocked cell would cross it.
direction: right
vars: {
d2-config: {
layout-engine: tala
theme-id: 0
}
}
classes: {
span-blue: {
style.fill: "#eff6ff"
style.stroke: "#2563eb"
style.stroke-width: 2
style.border-radius: 16
style.font-color: "#0f172a"
style.font-size: 32
style.bold: true
}
span-violet: {
style.fill: "#faf5ff"
style.stroke: "#7c3aed"
style.stroke-width: 2
style.border-radius: 16
style.font-color: "#0f172a"
style.font-size: 32
style.bold: true
}
state: {
label.near: top-center
style.border-radius: 10
style.font-color: "#0f172a"
style.font-size: 30
style.bold: true
}
state-blue: {style.fill: "#dbeafe"; style.stroke: "#93c5fd"}
state-violet: {style.fill: "#ede9fe"; style.stroke: "#c4b5fd"}
state-teal: {style.fill: "#ccfbf1"; style.stroke: "#5eead4"}
detail: {
shape: text
style.font-size: 26
style.bold: false
style.font-color: "#334155"
}
flow: {style.stroke: "#334155"; style.stroke-width: 2; style.font-color: "#334155"; style.font-size: 24}
flow-dashed: {style.stroke-dash: 5}
}
page: "" {
style.opacity: 0
grid-columns: 1
grid-gap: 24
timeline: "" {
style.opacity: 0
grid-rows: 1
horizontal-gap: 180
vertical-gap: 40
before: Running {
class: [state; state-blue]
detail: "on-CPU:\nCPU profilers\nsample here" {class: detail}
}
offcpu: "off-CPU interval" {
class: span-violet
grid-rows: 1
horizontal-gap: 180
vertical-gap: 40
sleeping: "Blocked (sleeping)" {
class: [state; state-violet]
detail: "Blocked until an event:\nfutex, socket data,\ndisk I/O, timer" {class: detail}
}
runnable: Runnable {
class: [state; state-teal]
detail: "Woken; in the run queue\nwaiting for a free CPU" {class: detail}
}
sleeping -> runnable: sched_wakeup {class: flow}
}
after: Running {
class: [state; state-blue]
detail: "on-CPU:\nCPU profilers\nsample here" {class: detail}
}
}
note: "jonoffcpu measures the whole off-CPU interval, from switch-out to switch-in.\nIt records why it began: blocked, or runnable/preempted,\nwhen the thread skips Blocked and only waits for a CPU." {class: detail}
}
page.timeline.before -> page.timeline.offcpu.sleeping: sched_switch {class: flow}
page.timeline.offcpu.runnable -> page.timeline.after: sched_switch {class: flow}
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.