1 #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 8 extern "C" { 9 #endif 10 11 /// Sets the scheduler policy for a task. 12 /// 13 /// Sets the scheduler policy for a task to the class described by a semantic 14 /// string. 15 /// 16 /// Supported policies are device-specific. 17 /// 18 /// @param task_id The task id of task to set the policy for. When task_id is 0 19 /// the current task id is substituted. 20 /// @param scheduler_policy NULL-terminated ASCII string containing the desired 21 /// scheduler policy. 22 /// @returns Returns 0 on success or a negative errno error code on error. 23 int dvrSetSchedulerPolicy(pid_t task_id, const char* scheduler_policy); 24 25 /// Sets the CPU partition for a task. 26 /// 27 /// Sets the CPU partition for a task to the partition described by a CPU 28 /// partition path. 29 /// 30 /// TODO(eieio): Describe supported partitions and rules governing assignment. 31 /// 32 /// @param task_id The task id of task to attach to a partition. When task_id is 33 /// 0 the current task id is substituted. 34 /// @param partition NULL-terminated ASCII string describing the CPU partition 35 /// to attach the task to. 36 /// @returns Returns 0 on success or a negative errno error code on error. 37 int dvrSetCpuPartition(pid_t task_id, const char* partition); 38 39 /// Sets the scheduler class for a task. 40 /// 41 /// Sets the scheduler class for a task to the class described by a semantic 42 /// string. 43 /// 44 /// Supported classes for applications are: audio, graphics, normal, and 45 /// background. Additional options following a ':' to be supported in the 46 /// future. 47 /// 48 /// @param task_id The task id of task to attach to a partition. When task_id is 49 /// 0 the current task id is substituted. 50 /// @param scheduler_class NULL-terminated ASCII string containing the desired 51 /// scheduler class. 52 /// @returns Returns 0 on success or a negative errno error code on error. 53 int dvrSetSchedulerClass(pid_t task_id, const char* scheduler_class); 54 55 /// Gets the CPU partition for a task. 56 /// 57 /// Gets the CPU partition path for a task as a NULL-terminated ASCII string. If 58 /// the path is too large to fit in the supplied buffer, -ENOBUFS is returned. 59 /// 60 /// @param task_id The task id of the task to retrieve the partition for. When 61 /// task_id is 0 the current task id is substituted. 62 /// @param partition Pointer to an ASCII string buffer to store the partition 63 /// path. 64 /// @param size Size of the string buffer in bytes, including space for the NULL 65 /// terminator. 66 /// @returns Returns 0 on success or a negative errno error code on error. 67 int dvrGetCpuPartition(pid_t task_id, char* partition, size_t size); 68 69 #ifdef __cplusplus 70 } // extern "C" 71 #endif 72 73 #endif // ANDROID_DVR_PERFORMANCE_CLIENT_API_H_ 74