Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
cm-projects
RIOT
Commits
3ac6d6c8
Commit
3ac6d6c8
authored
7 years ago
by
Sebastian Meiling
Browse files
Options
Downloads
Patches
Plain Diff
schedstats: refine ps output
- use unsigned int instead of double
parent
e7136e2d
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
sys/ps/ps.c
+22
-10
22 additions, 10 deletions
sys/ps/ps.c
with
22 additions
and
10 deletions
sys/ps/ps.c
+
22
−
10
View file @
3ac6d6c8
...
@@ -61,10 +61,10 @@ void ps(void)
...
@@ -61,10 +61,10 @@ void ps(void)
#endif
#endif
"%-9sQ | pri "
"%-9sQ | pri "
#ifdef DEVELHELP
#ifdef DEVELHELP
"| stack ( used) | base
| current "
"| stack
( used) | base
addr
| current "
#endif
#endif
#ifdef MODULE_SCHEDSTATISTICS
#ifdef MODULE_SCHEDSTATISTICS
"| runtime | switches"
"| runtime
| switches"
#endif
#endif
"
\n
"
,
"
\n
"
,
#ifdef DEVELHELP
#ifdef DEVELHELP
...
@@ -77,13 +77,23 @@ void ps(void)
...
@@ -77,13 +77,23 @@ void ps(void)
void
*
isr_start
=
thread_arch_isr_stack_start
();
void
*
isr_start
=
thread_arch_isr_stack_start
();
void
*
isr_sp
=
thread_arch_isr_stack_pointer
();
void
*
isr_sp
=
thread_arch_isr_stack_pointer
();
printf
(
"
\t
- | isr_stack | - - |"
printf
(
"
\t
- | isr_stack | - - |"
" - | %
5
i (%5i) | %10p | %10p
\n
"
,
ISR_STACKSIZE
,
isr_usage
,
isr_start
,
isr_sp
);
" - | %
6
i (%5i) | %10p | %10p
\n
"
,
ISR_STACKSIZE
,
isr_usage
,
isr_start
,
isr_sp
);
overall_stacksz
+=
ISR_STACKSIZE
;
overall_stacksz
+=
ISR_STACKSIZE
;
if
(
isr_usage
>
0
)
{
if
(
isr_usage
>
0
)
{
overall_used
+=
isr_usage
;
overall_used
+=
isr_usage
;
}
}
#endif
#endif
#ifdef MODULE_SCHEDSTATISTICS
uint64_t
rt_sum
=
0
;
for
(
kernel_pid_t
i
=
KERNEL_PID_FIRST
;
i
<=
KERNEL_PID_LAST
;
i
++
)
{
thread_t
*
p
=
(
thread_t
*
)
sched_threads
[
i
];
if
(
p
!=
NULL
)
{
rt_sum
+=
sched_pidlist
[
i
].
runtime_ticks
;
}
}
#endif
/* MODULE_SCHEDSTATISTICS */
for
(
kernel_pid_t
i
=
KERNEL_PID_FIRST
;
i
<=
KERNEL_PID_LAST
;
i
++
)
{
for
(
kernel_pid_t
i
=
KERNEL_PID_FIRST
;
i
<=
KERNEL_PID_LAST
;
i
++
)
{
thread_t
*
p
=
(
thread_t
*
)
sched_threads
[
i
];
thread_t
*
p
=
(
thread_t
*
)
sched_threads
[
i
];
...
@@ -98,9 +108,11 @@ void ps(void)
...
@@ -98,9 +108,11 @@ void ps(void)
overall_used
+=
stacksz
;
overall_used
+=
stacksz
;
#endif
#endif
#ifdef MODULE_SCHEDSTATISTICS
#ifdef MODULE_SCHEDSTATISTICS
double
runtime_ticks
=
sched_pidlist
[
i
].
runtime_ticks
/
/* multiply with 100 for percentage and to avoid floats/doubles */
(
double
)
_xtimer_now64
()
*
100
;
uint64_t
runtime_ticks
=
sched_pidlist
[
i
].
runtime_ticks
*
100
;
int
switches
=
sched_pidlist
[
i
].
schedules
;
unsigned
runtime_major
=
runtime_ticks
/
rt_sum
;
unsigned
runtime_minor
=
((
runtime_ticks
%
rt_sum
)
*
1000
)
/
rt_sum
;
unsigned
switches
=
sched_pidlist
[
i
].
schedules
;
#endif
#endif
printf
(
"
\t
%3"
PRIkernel_pid
printf
(
"
\t
%3"
PRIkernel_pid
#ifdef DEVELHELP
#ifdef DEVELHELP
...
@@ -108,10 +120,10 @@ void ps(void)
...
@@ -108,10 +120,10 @@ void ps(void)
#endif
#endif
" | %-8s %.1s | %3i"
" | %-8s %.1s | %3i"
#ifdef DEVELHELP
#ifdef DEVELHELP
" | %
5
i (%5i) | %10p | %10p "
" | %
6
i (%5i) | %10p | %10p "
#endif
#endif
#ifdef MODULE_SCHEDSTATISTICS
#ifdef MODULE_SCHEDSTATISTICS
" | %
6.3f
%% | %8
d
"
" | %
2d.%03d
%% | %8
u
"
#endif
#endif
"
\n
"
,
"
\n
"
,
p
->
pid
,
p
->
pid
,
...
@@ -123,14 +135,14 @@ void ps(void)
...
@@ -123,14 +135,14 @@ void ps(void)
,
p
->
stack_size
,
stacksz
,
(
void
*
)
p
->
stack_start
,
(
void
*
)
p
->
sp
,
p
->
stack_size
,
stacksz
,
(
void
*
)
p
->
stack_start
,
(
void
*
)
p
->
sp
#endif
#endif
#ifdef MODULE_SCHEDSTATISTICS
#ifdef MODULE_SCHEDSTATISTICS
,
runtime_
ticks
,
switches
,
runtime_
major
,
runtime_minor
,
switches
#endif
#endif
);
);
}
}
}
}
#ifdef DEVELHELP
#ifdef DEVELHELP
printf
(
"
\t
%5s %-21s|%13s%6s %
5
i (%5i)
\n
"
,
"|"
,
"SUM"
,
"|"
,
"|"
,
printf
(
"
\t
%5s %-21s|%13s%6s %
6
i (%5i)
\n
"
,
"|"
,
"SUM"
,
"|"
,
"|"
,
overall_stacksz
,
overall_used
);
overall_stacksz
,
overall_used
);
# ifdef MODULE_TLSF
# ifdef MODULE_TLSF
puts
(
"
\n
Heap usage:"
);
puts
(
"
\n
Heap usage:"
);
...
...
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