summaryrefslogtreecommitdiffstats
path: root/libcutils
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2012-03-15 15:45:19 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-03-15 15:45:19 -0700
commit0ad682cddef396c91707a31d4982dc55206dca1b (patch)
treecaddef67ccc69d7f00031f21f003e91dbc8a4735 /libcutils
parentc4c631a15f04bdcbf8c70737e818c7e4efd5ff7b (diff)
parent86c7cc81891a69ace7044de667b0624c284ee82b (diff)
downloadsystem_core-0ad682cddef396c91707a31d4982dc55206dca1b.zip
system_core-0ad682cddef396c91707a31d4982dc55206dca1b.tar.gz
system_core-0ad682cddef396c91707a31d4982dc55206dca1b.tar.bz2
Merge "Add get_sched_policy_name() and use in ps and top"
Diffstat (limited to 'libcutils')
-rw-r--r--libcutils/sched_policy.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libcutils/sched_policy.c b/libcutils/sched_policy.c
index f9c111e..35d362a 100644
--- a/libcutils/sched_policy.c
+++ b/libcutils/sched_policy.c
@@ -273,5 +273,17 @@ int set_sched_policy(int tid, SchedPolicy policy)
return 0;
}
+const char *get_sched_policy_name(SchedPolicy policy)
+{
+ static const char * const strings[SP_CNT] = {
+ [SP_BACKGROUND] = "bg",
+ [SP_FOREGROUND] = "fg",
+ };
+ if ((policy < SP_CNT) && (strings[policy] != NULL))
+ return strings[policy];
+ else
+ return "error";
+}
+
#endif /* HAVE_PTHREADS */
#endif /* HAVE_SCHED_H */