Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kernel Program Behaviour Models
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
felixkhals
Kernel Program Behaviour Models
Commits
4242685e
Commit
4242685e
authored
2 years ago
by
fu5520tp
Browse files
Options
Downloads
Patches
Plain Diff
inital procfs support
parent
5e9f0f1b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
kernel/sched/pb.c
+105
-0
105 additions, 0 deletions
kernel/sched/pb.c
with
105 additions
and
0 deletions
kernel/sched/pb.c
+
105
−
0
View file @
4242685e
#include
<linux/seq_file.h>
#include
<linux/proc_fs.h>
#include
"perf_error_detection.h"
#include
<linux/syscalls.h>
...
...
@@ -251,3 +253,106 @@ const struct sched_class pb_sched_class = {
EXPORT_SYMBOL
(
pb_sched_class
);
///////////////////// ProcFS Ausgabe ///////////////////////////////////
static
int
show_pbsched
(
struct
seq_file
*
seq
,
void
*
v
)
{
int
cpu
;
if
(
v
==
(
void
*
)
1
)
{
seq_printf
(
seq
,
"cpuid mode curr_entry curr_pb_cycles curr_admin_cycles
\n
"
);
}
else
{
char
mode
;
struct
rq
*
rq
;
struct
pb_rq
*
pb
;
cpu
=
(
unsigned
long
)(
v
-
2
);
rq
=
cpu_rq
(
cpu
);
pb
=
&
(
rq
->
pb
);
switch
(
pb
->
mode
)
{
case
PB_DISABLED_MODE
:
mode
=
'D'
;
break
;
case
PB_EXEC_MODE
:
mode
=
'E'
;
break
;
case
PB_ADMIN_MODE
:
mode
=
'A'
;
break
;
default:
mode
=
'U'
;
break
;
}
/* runqueue-specific stats */
seq_printf
(
seq
,
"cpu%d %c %u %llu %llu
\n
"
,
cpu
,
mode
,
pb
->
c_entry
,
pb
->
count_pb_cycles
,
pb
->
count_admin_cycles
);
}
return
0
;
}
/*
* This itererator needs some explanation.
* It returns 1 for the header position.
* This means 2 is cpu 0.
* In a hotplugged system some cpus, including cpu 0, may be missing so we have
* to use cpumask_* to iterate over the cpus.
*/
static
void
*
pbsched_start
(
struct
seq_file
*
file
,
loff_t
*
offset
)
{
unsigned
long
n
=
*
offset
;
if
(
n
==
0
)
return
(
void
*
)
1
;
n
--
;
if
(
n
>
0
)
n
=
cpumask_next
(
n
-
1
,
cpu_online_mask
);
else
n
=
cpumask_first
(
cpu_online_mask
);
*
offset
=
n
+
1
;
if
(
n
<
nr_cpu_ids
)
return
(
void
*
)(
unsigned
long
)(
n
+
2
);
return
NULL
;
}
static
void
*
pbsched_next
(
struct
seq_file
*
file
,
void
*
data
,
loff_t
*
offset
)
{
(
*
offset
)
++
;
return
pbsched_start
(
file
,
offset
);
}
static
void
pbsched_stop
(
struct
seq_file
*
file
,
void
*
data
)
{
// NOP
}
static
const
struct
seq_operations
pbsched_sops
=
{
.
start
=
pbsched_start
,
.
next
=
pbsched_next
,
.
stop
=
pbsched_stop
,
.
show
=
show_pbsched
,
};
static
int
pbsched_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
seq_open
(
file
,
&
pbsched_sops
);
}
static
const
struct
file_operations
proc_pbsched_operations
=
{
.
open
=
pbsched_open
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
seq_release
,
};
static
int
__init
proc_pbsched_init
(
void
)
{
proc_create
(
"pbsched"
,
0
,
NULL
,
&
proc_pbsched_operations
);
return
0
;
}
subsys_initcall
(
proc_pbsched_init
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment