Add get_sched_policy_name() and use in ps and top
This will make it easier to add additional policies (cgroups) if needed.
Also added comments to the sched_policy APIs.
Change-Id: I33ce1cc4deae10983241f7391294b7a512d2c47c
diff --git a/toolbox/ps.c b/toolbox/ps.c
index 7c3de4a..7c35ccb 100644
--- a/toolbox/ps.c
+++ b/toolbox/ps.c
@@ -167,14 +167,8 @@
SchedPolicy p;
if (get_sched_policy(pid, &p) < 0)
printf(" un ");
- else {
- if (p == SP_BACKGROUND)
- printf(" bg ");
- else if (p == SP_FOREGROUND)
- printf(" fg ");
- else
- printf(" er ");
- }
+ else
+ printf(" %.2s ", get_sched_policy_name(p));
}
printf(" %08x %08x %s %s", wchan, eip, state, cmdline[0] ? cmdline : name);
if(display_flags&SHOW_TIME)