libgpac
Documentation of the core library of GPAC
|
Threading and Mutual Exclusion. More...
Modules | |
Thread | |
Thread processing. | |
Mutex | |
Mutual exclusion. | |
Semaphore | |
Semaphore. | |
Data Structures | |
struct | GF_SystemRTInfo |
run-time system info object More... | |
Enumerations | |
enum | GF_LockStatus { GF_LOCKFILE_FAILED =0 , GF_LOCKFILE_NEW , GF_LOCKFILE_REUSE } |
enum | { GF_RTI_ALL_PROCESSES_TIMES = 1 , GF_RTI_PROCESS_MEMORY = 1<<1 , GF_RTI_SYSTEM_MEMORY_ONLY = 1<<2 } |
Functions | |
u32 | gf_sys_get_process_id () |
Gets process ID. More... | |
GF_LockStatus | gs_sys_create_lockfile (const char *lockfile) |
Creates a lock file. More... | |
Bool | gf_sys_check_process_id (u32 process_id) |
Checks a process is valid. More... | |
Bool | gf_sys_get_rti (u32 refresh_time_ms, GF_SystemRTInfo *rti, u32 flags) |
Gets Run-Time info. More... | |
Time manipulation tools.
This section documents the threading of the GPAC framework. These provide an easy way to implement safe multithreaded tools.
Available tools are thread, mutex and semaphore
struct GF_SystemRTInfo |
The Run-Time Info object is used to get CPU and memory occupation of the calling process. All time values are expressed in milliseconds (accuracy is not guaranteed).
Data Fields | ||
---|---|---|
u32 | sampling_instant |
start of the sampling period |
u32 | sampling_period_duration |
duration of the sampling period |
u32 | total_cpu_time |
total amount of time (User+kernel) spent in CPU for all processes as evaluated at the end of the sampling period |
u32 | process_cpu_time |
total amount of time (User+kernel) spent in CPU for the calling process as evaluated at the end of the sampling period |
u32 | total_cpu_time_diff |
amount of time (User+kernel) spent in CPU for all processes during the sampling period |
u32 | process_cpu_time_diff |
total amount of time (User+kernel) spent in CPU for the calling process during the sampling period |
u32 | cpu_idle_time |
total amount of idle time during the sampling period. |
u32 | total_cpu_usage |
percentage (from 0 to 100) of CPU usage during the sampling period. |
u32 | process_cpu_usage |
percentage (from 0 to 100) of the CPU usage by the calling process during the sampling period. |
u32 | pid |
calling process ID |
u32 | thread_count |
calling process thread count if known |
u64 | process_memory |
size of calling process allocated heaps |
u64 | physical_memory |
total physical memory in system |
u64 | physical_memory_avail |
available physical memory in system |
u64 | gpac_memory |
total memory currently allocated by gpac |
u32 | nb_cores |
total number of cores on the system |
enum GF_LockStatus |
anonymous enum |
Selection flags for run-time info retrieval
u32 gf_sys_get_process_id | ( | ) |
Gets ID of the process running this gpac instance.
GF_LockStatus gs_sys_create_lockfile | ( | const char * | lockfile | ) |
Creates a lock file for the current process. A lockfile contains a single string giving the creator process ID If a lock file exists with a process ID no longer running, the lock file will be granted to the caller. Lock files are removed using gf_file_delete
lockfile | name of the lockfile |
Checks if a process is running by its ID
process_id | process ID |
Bool gf_sys_get_rti | ( | u32 | refresh_time_ms, |
GF_SystemRTInfo * | rti, | ||
u32 | flags | ||
) |
Gets CPU and memory usage info for the calling process and the system. Information gathering is controled through timeout values.
refresh_time_ms | refresh time period in milliseconds. If the last sampling was done less than this period ago, the run-time info is not refreshed. |
rti | holder to the run-time info structure to update. |
flags | specify which info is to be retrieved. |