← Documents Documentation/ABI/testing/sysfs-bus-event_source-devices-events GitHub 원문 ↗

Linux 6.18.37 · ABI / testing

Perf event aliases sysfs ABI

Generic CPU와 per-PMU symbolic performance events의 file naming·term grammar·parameterization, numerical unit와 scaling-factor contracts를 설명합니다.

Source pathDocumentation/ABI/testing/sysfs-bus-event_source-devices-events
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

Generic CPU performance events

sysfs-bus-event_source-devices-events:1-27

많은 CPU가 지원할 수 있는 generic events를 perf(1)로 monitor하며 각 file은 basename event의 raw code를 event=0xNNNN 형식으로 제공합니다.

Per-PMU event naming과 term syntax

sysfs-bus-event_source-devices-events:30-73

각 event file은 format terms에 lowercase-0x hexadecimal values를 assign하며 bare term은 0x1, param=?는 userspace-supplied event parameter를 뜻합니다.

Event numerical unit

sysfs-bus-event_source-devices-events:75-85

event.unit은 scale을 곱한 event count가 나타내는 English plural numerical unit을 제공합니다.

Event scaling factor

sysfs-bus-event_source-devices-events:87-102

event.scale은 kernel count에 곱할 scientific-notation floating-point factor이며 kernel 내부 floating-point arithmetic을 피합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 What: /sys/devices/cpu/events/
2 /sys/devices/cpu/events/branch-misses
3 /sys/devices/cpu/events/cache-references
4 /sys/devices/cpu/events/cache-misses
5 /sys/devices/cpu/events/stalled-cycles-frontend
6 /sys/devices/cpu/events/branch-instructions
7 /sys/devices/cpu/events/stalled-cycles-backend
8 /sys/devices/cpu/events/instructions
9 /sys/devices/cpu/events/cpu-cycles
10
11 Date: 2013/01/08
12
13 Contact: Linux kernel mailing list <[email protected]>
14
15 Description: Generic performance monitoring events
16
17 A collection of performance monitoring events that may be
18 supported by many/most CPUs. These events can be monitored
19 using the 'perf(1)' tool.
20
21 The contents of each file would look like:
22
23 event=0xNNNN
24
25 where 'N' is a hex digit and the number '0xNNNN' shows the
26 "raw code" for the perf event identified by the file's
27 "basename".
28
29
30 What: /sys/bus/event_source/devices/<pmu>/events/<event>
31 Date: 2014/02/24
32 Contact: Linux kernel mailing list <[email protected]>
33 Description: Per-pmu performance monitoring events specific to the running system
34
35 Each file (except for some of those with a '.' in them, '.unit'
36 and '.scale') in the 'events' directory describes a single
37 performance monitoring event supported by the <pmu>. The name
38 of the file is the name of the event.
39
40 As performance monitoring event names are case insensitive
41 in the perf tool, the perf tool only looks for all lower
42 case or all upper case event names in sysfs to avoid
43 scanning the directory. It is therefore required the
44 name of the event here is either completely lower or upper
45 case, with no mixed-case characters. Numbers, '.', '_', and
46 '-' are also allowed.
47
48 File contents:
49
50 <term>[=<value>][,<term>[=<value>]]...
51
52 Where <term> is one of the terms listed under
53 /sys/bus/event_source/devices/<pmu>/format/ and <value> is
54 a number is base-16 format with a '0x' prefix (lowercase only).
55 If a <term> is specified alone (without an assigned value), it
56 is implied that 0x1 is assigned to that <term>.
57
58 Examples (each of these lines would be in a separate file):
59
60 event=0x2abc
61 event=0x423,inv,cmask=0x3
62 domain=0x1,offset=0x8,starting_index=0xffff
63 domain=0x1,offset=0x8,core=?
64
65 Each of the assignments indicates a value to be assigned to a
66 particular set of bits (as defined by the format file
67 corresponding to the <term>) in the perf_event structure passed
68 to the perf_open syscall.
69
70 In the case of the last example, a value replacing "?" would
71 need to be provided by the user selecting the particular event.
72 This is referred to as "event parameterization". Event
73 parameters have the format 'param=?'.
74
75 What: /sys/bus/event_source/devices/<pmu>/events/<event>.unit
76 Date: 2014/02/24
77 Contact: Linux kernel mailing list <[email protected]>
78 Description: Perf event units
79
80 A string specifying the English plural numerical unit that <event>
81 (once multiplied by <event>.scale) represents.
82
83 Example:
84
85 Joules
86
87 What: /sys/bus/event_source/devices/<pmu>/events/<event>.scale
88 Date: 2014/02/24
89 Contact: Linux kernel mailing list <[email protected]>
90 Description: Perf event scaling factors
91
92 A string representing a floating point value expressed in
93 scientific notation to be multiplied by the event count
94 received from the kernel to match the unit specified in the
95 <event>.unit file.
96
97 Example:
98
99 2.3283064365386962890625e-10
100
101 This is provided to avoid performing floating point arithmetic
102 in the kernel.
103

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

Generic CPU performance-monitoring events

1-27
What paths
/sys/devices/cpu/events/
/sys/devices/cpu/events/branch-misses
/sys/devices/cpu/events/cache-references
/sys/devices/cpu/events/cache-misses
/sys/devices/cpu/events/stalled-cycles-frontend
/sys/devices/cpu/events/branch-instructions
/sys/devices/cpu/events/stalled-cycles-backend
/sys/devices/cpu/events/instructions
/sys/devices/cpu/events/cpu-cycles
항목전문 번역
Date2013/01/08
ContactLinux kernel mailing list <[email protected]>
DescriptionGeneric performance monitoring events입니다.

많거나 대부분의 CPUs가 지원할 수 있는 performance monitoring events 모음이며 perf(1) tool로 monitor할 수 있습니다. 각 file의 내용은 다음과 같습니다.

event=0xNNNN

N은 hex digit이며 0xNNNN은 file basename으로 식별되는 perf event의 raw code를 나타냅니다.

Per-PMU symbolic event syntax

30-73
항목전문 번역
What/sys/bus/event_source/devices/<pmu>/events/<event>
Date2014/02/24
ContactLinux kernel mailing list <[email protected]>
Description실행 중인 system의 per-PMU performance monitoring events입니다.

events directory의 각 file은 이름에 .이 들어간 일부 files인 .unit과 .scale을 제외하면 <pmu>가 지원하는 단일 performance monitoring event를 설명합니다. File name이 event name입니다.

Perf tool에서 performance event names는 case-insensitive이므로 directory scan을 피하기 위해 perf는 sysfs에서 모두 lowercase 또는 모두 uppercase인 event names만 찾습니다. 따라서 event name은 mixed-case 없이 완전히 lowercase 또는 uppercase여야 합니다. Numbers, ., _, -도 허용됩니다.

File 내용 형식:

<term>[=<value>][,<term>[=<value>]]...

<term>은 /sys/bus/event_source/devices/<pmu>/format/ 아래에 나열된 terms 중 하나이고 <value>는 lowercase 0x prefix를 사용하는 base-16 number입니다. Assigned value 없이 <term>만 지정하면 해당 term에 0x1을 assign한 것으로 봅니다.

각 줄이 별도 file에 들어가는 examples:

event=0x2abc
event=0x423,inv,cmask=0x3
domain=0x1,offset=0x8,starting_index=0xffff
domain=0x1,offset=0x8,core=?

각 assignment는 perf_open syscall에 전달되는 perf_event structure에서 <term>에 해당하는 format file이 정의한 특정 bit set에 value를 assign합니다. 마지막 example의 ?를 대체할 value는 특정 event를 선택하는 user가 제공해야 합니다. 이를 event parameterization이라고 하며 event parameters 형식은 param=?입니다.

Perf event unit

75-85
항목전문 번역
What/sys/bus/event_source/devices/<pmu>/events/<event>.unit
Date2014/02/24
ContactLinux kernel mailing list <[email protected]>
DescriptionPerf event units입니다.

<event>에 <event>.scale을 곱한 값이 나타내는 English plural numerical unit을 지정하는 문자열입니다.

Joules

Perf event scaling factor

87-102
항목전문 번역
What/sys/bus/event_source/devices/<pmu>/events/<event>.scale
Date2014/02/24
ContactLinux kernel mailing list <[email protected]>
DescriptionPerf event scaling factors입니다.

Kernel에서 받은 event count에 곱해 <event>.unit file의 unit과 맞추는, scientific notation으로 표현된 floating-point value 문자열입니다.

2.3283064365386962890625e-10

Kernel에서 floating-point arithmetic을 수행하지 않도록 이 값을 제공합니다.

Perf event count scaling
Kernel event countMultiply by <event>.scaleValue in <event>.unit

Kernel raw count에 userspace가 scale을 곱해 unit file이 정의하는 물리 단위 값을 얻습니다.