Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
39d2edc4
Commit
39d2edc4
authored
Aug 17, 2003
by
Doug Ledford
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add irq and softirq time accounting to the kernel
parent
a1ad3d82
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
9 deletions
+23
-9
fs/proc/proc_misc.c
fs/proc/proc_misc.c
+11
-5
include/linux/kernel_stat.h
include/linux/kernel_stat.h
+2
-0
kernel/sched.c
kernel/sched.c
+10
-4
No files found.
fs/proc/proc_misc.c
View file @
39d2edc4
...
...
@@ -362,7 +362,7 @@ static int kstat_read_proc(char *page, char **start, off_t off,
int
i
,
len
;
extern
unsigned
long
total_forks
;
u64
jif
;
unsigned
int
sum
=
0
,
user
=
0
,
nice
=
0
,
system
=
0
,
idle
=
0
,
iowait
=
0
;
unsigned
int
sum
=
0
,
user
=
0
,
nice
=
0
,
system
=
0
,
idle
=
0
,
iowait
=
0
,
irq
=
0
,
softirq
=
0
;
struct
timeval
now
;
unsigned
long
seq
;
...
...
@@ -388,25 +388,31 @@ static int kstat_read_proc(char *page, char **start, off_t off,
system
+=
kstat_cpu
(
i
).
cpustat
.
system
;
idle
+=
kstat_cpu
(
i
).
cpustat
.
idle
;
iowait
+=
kstat_cpu
(
i
).
cpustat
.
iowait
;
irq
+=
kstat_cpu
(
i
).
cpustat
.
irq
;
softirq
+=
kstat_cpu
(
i
).
cpustat
.
softirq
;
for
(
j
=
0
;
j
<
NR_IRQS
;
j
++
)
sum
+=
kstat_cpu
(
i
).
irqs
[
j
];
}
len
=
sprintf
(
page
,
"cpu %u %u %u %u %u
\n
"
,
len
=
sprintf
(
page
,
"cpu %u %u %u %u %u
%u %u
\n
"
,
jiffies_to_clock_t
(
user
),
jiffies_to_clock_t
(
nice
),
jiffies_to_clock_t
(
system
),
jiffies_to_clock_t
(
idle
),
jiffies_to_clock_t
(
iowait
));
jiffies_to_clock_t
(
iowait
),
jiffies_to_clock_t
(
irq
),
jiffies_to_clock_t
(
softirq
));
for
(
i
=
0
;
i
<
NR_CPUS
;
i
++
){
if
(
!
cpu_online
(
i
))
continue
;
len
+=
sprintf
(
page
+
len
,
"cpu%d %u %u %u %u %u
\n
"
,
len
+=
sprintf
(
page
+
len
,
"cpu%d %u %u %u %u %u
%u %u
\n
"
,
i
,
jiffies_to_clock_t
(
kstat_cpu
(
i
).
cpustat
.
user
),
jiffies_to_clock_t
(
kstat_cpu
(
i
).
cpustat
.
nice
),
jiffies_to_clock_t
(
kstat_cpu
(
i
).
cpustat
.
system
),
jiffies_to_clock_t
(
kstat_cpu
(
i
).
cpustat
.
idle
),
jiffies_to_clock_t
(
kstat_cpu
(
i
).
cpustat
.
iowait
));
jiffies_to_clock_t
(
kstat_cpu
(
i
).
cpustat
.
iowait
),
jiffies_to_clock_t
(
kstat_cpu
(
i
).
cpustat
.
irq
),
jiffies_to_clock_t
(
kstat_cpu
(
i
).
cpustat
.
softirq
));
}
len
+=
sprintf
(
page
+
len
,
"intr %u"
,
sum
);
...
...
include/linux/kernel_stat.h
View file @
39d2edc4
...
...
@@ -17,6 +17,8 @@ struct cpu_usage_stat {
unsigned
int
user
;
unsigned
int
nice
;
unsigned
int
system
;
unsigned
int
softirq
;
unsigned
int
irq
;
unsigned
int
idle
;
unsigned
int
iowait
;
};
...
...
kernel/sched.c
View file @
39d2edc4
...
...
@@ -1201,11 +1201,17 @@ void scheduler_tick(int user_ticks, int sys_ticks)
if
(
rcu_pending
(
cpu
))
rcu_check_callbacks
(
cpu
,
user_ticks
);
/* note: this timer irq context must be accounted for as well */
if
(
hardirq_count
()
-
HARDIRQ_OFFSET
)
{
cpustat
->
irq
+=
sys_ticks
;
sys_ticks
=
0
;
}
else
if
(
softirq_count
())
{
cpustat
->
softirq
+=
sys_ticks
;
sys_ticks
=
0
;
}
if
(
p
==
rq
->
idle
)
{
/* note: this timer irq context must be accounted for as well */
if
(
irq_count
()
-
HARDIRQ_OFFSET
>=
SOFTIRQ_OFFSET
)
cpustat
->
system
+=
sys_ticks
;
else
if
(
atomic_read
(
&
rq
->
nr_iowait
)
>
0
)
if
(
atomic_read
(
&
rq
->
nr_iowait
)
>
0
)
cpustat
->
iowait
+=
sys_ticks
;
else
cpustat
->
idle
+=
sys_ticks
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment