mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-23 13:33:49 +01:00
Merge pull request #1352 from LudwigOrtmann/nofloat
sys/ps: don't use float for runtime calculations
This commit is contained in:
commit
e1b0efe9e6
13
sys/ps/ps.c
13
sys/ps/ps.c
@ -39,7 +39,6 @@ const char *state_names[] = {
|
|||||||
*/
|
*/
|
||||||
void thread_print_all(void)
|
void thread_print_all(void)
|
||||||
{
|
{
|
||||||
extern unsigned long hwtimer_now(void);
|
|
||||||
const char queued_name[] = {'_', 'Q'};
|
const char queued_name[] = {'_', 'Q'};
|
||||||
int i;
|
int i;
|
||||||
int overall_stacksz = 0;
|
int overall_stacksz = 0;
|
||||||
@ -55,19 +54,19 @@ void thread_print_all(void)
|
|||||||
tcb_t *p = (tcb_t *)sched_threads[i];
|
tcb_t *p = (tcb_t *)sched_threads[i];
|
||||||
|
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
int state = p->status; // copy state
|
int state = p->status; /* copy state */
|
||||||
const char *sname = state_names[state]; // get state name
|
const char *sname = state_names[state]; /* get state name */
|
||||||
const char *queued = &queued_name[(int)(state >= STATUS_ON_RUNQUEUE)]; // get queued flag
|
const char *queued = &queued_name[(int)(state >= STATUS_ON_RUNQUEUE)]; /* get queued flag */
|
||||||
int stacksz = p->stack_size; // get stack size
|
int stacksz = p->stack_size; /* get stack size */
|
||||||
#if SCHEDSTATISTICS
|
#if SCHEDSTATISTICS
|
||||||
double runtime_ticks = sched_pidlist[i].runtime_ticks / (double) hwtimer_now() * 100;
|
int runtime_ticks = sched_pidlist[i].runtime_ticks / (hwtimer_now()/1000UL + 1);
|
||||||
int switches = sched_pidlist[i].schedules;
|
int switches = sched_pidlist[i].schedules;
|
||||||
#endif
|
#endif
|
||||||
overall_stacksz += stacksz;
|
overall_stacksz += stacksz;
|
||||||
stacksz -= thread_measure_stack_free(p->stack_start);
|
stacksz -= thread_measure_stack_free(p->stack_start);
|
||||||
printf("\t%3u | %-21s| %-8s %.1s | %3i | %5i (%5i) %p"
|
printf("\t%3u | %-21s| %-8s %.1s | %3i | %5i (%5i) %p"
|
||||||
#if SCHEDSTATISTICS
|
#if SCHEDSTATISTICS
|
||||||
" | %6.3f%% | %8d"
|
" | %4d/1k | %8d"
|
||||||
#endif
|
#endif
|
||||||
"\n",
|
"\n",
|
||||||
p->pid, p->name, sname, queued, p->priority, p->stack_size, stacksz, p->stack_start
|
p->pid, p->name, sname, queued, p->priority, p->stack_size, stacksz, p->stack_start
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user