blob: 2216e3869a2eda4c076a27145c9a96ad35ca1ab2 [file] [log] [blame]
Alex Vakulenkoe4eec202017-01-27 14:41:04 -08001#ifndef ANDROID_DVR_PERFORMANCE_CLIENT_API_H_
2#define ANDROID_DVR_PERFORMANCE_CLIENT_API_H_
3
4#include <stddef.h>
5#include <unistd.h>
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11/// Sets the CPU partition for a task.
12///
13/// Sets the CPU partition for a task to the partition described by a CPU
14/// partition path.
15///
16/// TODO(eieio): Describe supported partitions and rules governing assignment.
17///
18/// @param task_id The task id of task to attach to a partition. When task_id is
19/// 0 the current task id is substituted.
20/// @param partition NULL-terminated ASCII string describing the CPU partition
21/// to attach the task to.
22/// @returns Returns 0 on success or a negative errno error code on error.
23int dvrSetCpuPartition(pid_t task_id, const char* partition);
24
25/// Sets the scheduler class for a task.
26///
27/// Sets the scheduler class for a task to the class described by a semantic
28/// string.
29///
30/// Supported classes for applications are: audio, graphics, normal, and
31/// background. Additional options following a ':' to be supported in the
32/// future.
33///
34/// @param task_id The task id of task to attach to a partition. When task_id is
35/// 0 the current task id is substituted.
36/// @param scheduler_class NULL-terminated ASCII string containing the desired
37/// scheduler class.
38/// @returns Returns 0 on success or a negative errno error code on error.
39int dvrSetSchedulerClass(pid_t task_id, const char* scheduler_class);
40
41/// Gets the CPU partition for a task.
42///
43/// Gets the CPU partition path for a task as a NULL-terminated ASCII string. If
44/// the path is too large to fit in the supplied buffer, -ENOBUFS is returned.
45///
46/// @param task_id The task id of the task to retrieve the partition for. When
47/// task_id is 0 the current task id is substituted.
48/// @param partition Pointer to an ASCII string buffer to store the partition
49/// path.
50/// @param size Size of the string buffer in bytes, including space for the NULL
51/// terminator.
52/// @returns Returns 0 on success or a negative errno error code on error.
53int dvrGetCpuPartition(pid_t task_id, char* partition, size_t size);
54
55#ifdef __cplusplus
56} // extern "C"
57#endif
58
59#endif // ANDROID_DVR_PERFORMANCE_CLIENT_API_H_