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
a911e01c
Commit
a911e01c
authored
2 years ago
by
fu5520tp
Browse files
Options
Downloads
Patches
Plain Diff
return counted instructions in procfs
parent
6bc5a61b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
kernel/sched/pb.c
+33
-2
33 additions, 2 deletions
kernel/sched/pb.c
kernel/sched/sched.h
+1
-0
1 addition, 0 deletions
kernel/sched/sched.h
with
34 additions
and
2 deletions
kernel/sched/pb.c
+
33
−
2
View file @
a911e01c
...
...
@@ -173,6 +173,7 @@ static struct task_struct * pick_next_task_pb(struct rq *rq,
// see 'perf_event_release_kernel(struct perf_event *event)' in core.c
pb
->
plan
[
c_entry_curr
].
perf_event
=
NULL
;
pb
->
plan
[
c_entry_curr
].
n_instr_counted
=
perf_counter
;
if
(
perf_counter
<
pb
->
plan
[
c_entry_curr
].
n_instr
)
{
u64
under_time
=
pb
->
plan
[
c_entry_curr
].
n_instr
-
perf_counter
;
...
...
@@ -305,13 +306,16 @@ static int show_pbsched(struct seq_file *seq, void *v)
char
mode
;
struct
rq
*
rq
;
struct
pb_rq
*
pb
;
// perf event stuff here is for testing and will be deleted in the future
struct
perf_event
*
event
;
int
perf_init_res
;
u64
perf_counter
;
u64
read_error
;
int
i
;
struct
plan_entry
*
plan
;
cpu
=
(
unsigned
long
)(
v
-
2
);
rq
=
cpu_rq
(
cpu
);
pb
=
&
(
rq
->
pb
);
...
...
@@ -344,6 +348,33 @@ static int show_pbsched(struct seq_file *seq, void *v)
pb
->
count_pb_cycles
,
pb
->
count_admin_cycles
);
/* plan stats */
if
(
pb
->
size
){
seq_printf
(
seq
,
"
\n
task_id n_instr n_instr_counted
\n
"
);
plan
=
pb
->
plan
;
for
(
i
=
0
;
i
<
pb
->
size
;
i
++
){
// only print completed tasks, after completion is_initialized is 0 and we can print the last
if
(
i
<
pb
->
c_entry
||
!
pb
->
is_initialized
){
seq_printf
(
seq
,
"%llu %llu %llu
\n
"
,
plan
[
i
].
task_id
,
plan
[
i
].
n_instr
,
plan
[
i
].
n_instr_counted
);
}
else
{
seq_printf
(
seq
,
"%llu %llu queued
\n
"
,
plan
[
i
].
task_id
,
plan
[
i
].
n_instr
);
}
}
}
}
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
kernel/sched/sched.h
+
1
−
0
View file @
a911e01c
...
...
@@ -529,6 +529,7 @@ struct plan_entry
u64
task_id
;
struct
task_struct
*
task_struct
;
// linux task struct
struct
perf_event
*
perf_event
;
u64
n_instr_counted
;
// number of instructions we counted for the entry
};
struct
pb_init_struct
...
...
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