Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
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
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
23d03559
Commit
23d03559
authored
8 years ago
by
Beat Küng
Committed by
Lorenz Meier
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
printload: reduce memory usage of print_load_s
assuming CONFIG_MAX_TASKS = 32, this saves 256B of RAM
parent
c4627404
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/modules/systemlib/printload.c
+11
-11
11 additions, 11 deletions
src/modules/systemlib/printload.c
src/modules/systemlib/printload.h
+1
-2
1 addition, 2 deletions
src/modules/systemlib/printload.h
with
12 additions
and
13 deletions
src/modules/systemlib/printload.c
+
11
−
11
View file @
23d03559
...
...
@@ -210,21 +210,21 @@ void print_load(uint64_t t, int fd, struct print_load_s *print_state)
}
interval_runtime
=
(
print_state
->
last_times
[
i
]
>
0
&&
system_load
.
tasks
[
i
].
total_runtime
>
print_state
->
last_times
[
i
])
?
(
system_load
.
tasks
[
i
].
total_runtime
-
print_state
->
last_times
[
i
])
/
1000
system_load
.
tasks
[
i
].
total_runtime
/
1000
>
print_state
->
last_times
[
i
])
?
(
system_load
.
tasks
[
i
].
total_runtime
/
1000
-
print_state
->
last_times
[
i
])
:
0
;
print_state
->
last_times
[
i
]
=
system_load
.
tasks
[
i
].
total_runtime
;
print_state
->
last_times
[
i
]
=
system_load
.
tasks
[
i
].
total_runtime
/
1000
;
float
current_load
=
0
.
f
;
if
(
print_state
->
new_time
>
print_state
->
interval_start_time
)
{
print_state
->
curr_load
s
[
i
]
=
interval_runtime
*
print_state
->
interval_time_ms_inv
;
curr
ent
_load
=
interval_runtime
*
print_state
->
interval_time_ms_inv
;
if
(
tcb_pid
!=
0
)
{
if
(
tcb_pid
!=
0
)
{
print_state
->
total_user_time
+=
interval_runtime
;
}
}
else
{
print_state
->
curr_loads
[
i
]
=
0
;
}
...
...
@@ -239,8 +239,8 @@ void print_load(uint64_t t, int fd, struct print_load_s *print_state)
float
task_load
;
float
sched_load
;
idle
=
print_state
->
curr_load
s
[
i
]
;
task_load
=
(
float
)(
print_state
->
total_user_time
)
*
print_state
->
interval_time_ms_inv
;
idle
=
curr
ent
_load
;
task_load
=
(
float
)(
print_state
->
total_user_time
)
*
print_state
->
interval_time_ms_inv
;
/* this can happen if one tasks total runtime was not computed
correctly by the scheduler instrumentation TODO */
...
...
@@ -301,8 +301,8 @@ void print_load(uint64_t t, int fd, struct print_load_s *print_state)
tcb_pid
,
CONFIG_TASK_NAME_SIZE
,
tcb_name
,
(
system_load
.
tasks
[
i
].
total_runtime
/
1000
),
(
int
)(
print_state
->
curr_load
s
[
i
]
*
100
.
0
f
),
(
int
)((
print_state
->
curr_load
s
[
i
]
*
100
.
0
f
-
(
int
)(
print_state
->
curr_load
s
[
i
]
*
100
.
0
f
))
*
1000
),
(
int
)(
curr
ent
_load
*
100
.
0
f
),
(
int
)((
curr
ent
_load
*
100
.
0
f
-
(
int
)(
curr
ent
_load
*
100
.
0
f
))
*
1000
),
stack_size
-
stack_free
,
stack_size
,
tcb_sched_priority
,
...
...
This diff is collapsed.
Click to expand it.
src/modules/systemlib/printload.h
+
1
−
2
View file @
23d03559
...
...
@@ -57,8 +57,7 @@ struct print_load_s {
uint64_t
new_time
;
uint64_t
interval_start_time
;
uint64_t
last_times
[
CONFIG_MAX_TASKS
];
float
curr_loads
[
CONFIG_MAX_TASKS
];
uint32_t
last_times
[
CONFIG_MAX_TASKS
];
// in [ms]. This wraps if a process needs more than 49 days of CPU
float
interval_time_ms_inv
;
};
...
...
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