GPAC
Open Source Multimedia Framework. For more information, check out http://gpac.wp.mines-telecom.fr
|
System time and CPU functions. More...
Data Structures | |
struct | GF_SystemRTInfo |
run-time system info object More... | |
Enumerations | |
enum | { GF_RTI_ALL_PROCESSES_TIMES = 1, GF_RTI_PROCESS_MEMORY = 1<<1, GF_RTI_SYSTEM_MEMORY_ONLY = 1<<2 } |
Functions | |
void | gf_sys_init (Bool enable_memory_tracker) |
System setup. More... | |
void | gf_sys_close () |
System closing. More... | |
u32 | gf_sys_clock () |
System clock query. More... | |
void | gf_sleep (u32 ms) |
Sleeps thread/process. More... | |
GF_Err | gf_rmdir (char *DirPathName) |
Delete Directory. More... | |
GF_Err | gf_mkdir (char *DirPathName) |
Create Directory. More... | |
GF_Err | gf_cleanup_dir (char *DirPathName) |
Create Directory. More... | |
u32 | gf_crc_32 (const char *data, u32 size) |
CRC32 compute. More... | |
u64 | gf_net_get_utc () |
gets UTC time in milliseconds More... | |
u64 | gf_net_parse_date (const char *date) |
parses date and returns UTC value for this date. Date format is an XSD dateTime format or any of the supported formats from HTTP 1.1: Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036 Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() formatgets UTC time in milliseconds More... | |
s32 | gf_net_get_timezone () |
gets timezone adjustment in seconds More... | |
GF_Err | gf_bin128_parse (char *string, bin128 value) |
parses 128 bit from string More... | |
Bool | gf_sys_get_rti (u32 refresh_time_ms, GF_SystemRTInfo *rti, u32 flags) |
Gets Run-Time info. More... | |
Bool | gf_sys_get_battery_state (Bool *onBattery, u32 *onCharge, u32 *level, u32 *batteryLifeTime, u32 *batteryFullLifeTime) |
GF_GlobalLock * | gf_global_resource_lock (const char *resourceName) |
GF_Err | gf_global_resource_unlock (GF_GlobalLock *lock) |
char * | gf_get_default_cache_directory () |
GF_Err | gf_gz_compress_payload (char **data, u32 data_len, u32 *out_size) |
GF_Err | gf_gz_decompress_payload (char *data, u32 data_len, char **uncompressed_data, u32 *out_size) |
GF_SHA1Context * | gf_sha1_starts () |
void | gf_sha1_update (GF_SHA1Context *ctx, u8 *input, u32 length) |
void | gf_sha1_finish (GF_SHA1Context *ctx, u8 digest[20]) |
int | gf_sha1_file (const char *filename, u8 digest[20]) |
void | gf_sha1_csum (u8 *buf, u32 buflen, u8 digest[20]) |
void | gf_sha1_csum_hexa (u8 *buf, u32 buflen, u8 digest[41]) |
This section documents time functionalities and CPU management in GPAC.
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 |
anonymous enum |
Selection flags for run-time info retrieval
void gf_sys_init | ( | Bool | enable_memory_tracker | ) |
Inits the system high-resolution clock if any, and CPU usage manager. It is strongly recommended to call this
function before calling any other GPAC functions, since on some systems (like winCE) it may result in a better memory usage estimation.
void gf_sys_close | ( | ) |
Closes the system high-resolution clock and any CPU associated ressources.
u32 gf_sys_clock | ( | ) |
Gets the system clock time.
void gf_sleep | ( | u32 | ms | ) |
Locks calling thread/process execution for a given time.
ms | Amount of time to sleep in milliseconds. |
GF_Err gf_rmdir | ( | char * | DirPathName | ) |
Delete a dir within the full path.
DirPathName | the file path name. |
GF_Err gf_mkdir | ( | char * | DirPathName | ) |
Create a directory within the full path.
DirPathName | the dir path name. |
GF_Err gf_cleanup_dir | ( | char * | DirPathName | ) |
Cleanup a directory within the full path, removing all the files and the directories.
DirPathName | the dir path name. |
Computes the CRC32 value of a buffer.
data | buffer |
size | buffer size |
u64 gf_net_get_utc | ( | ) |
Gets UTC clock in milliseconds
u64 gf_net_parse_date | ( | const char * | date | ) |
date | string containing the date to parse |
s32 gf_net_get_timezone | ( | ) |
Gets timezone adjustment in seconds, with localtime - timezone = UTC time
Parses 128 bit from string
string | the string containing the value in hexa. Non alphanum characters are skipped |
value | the value parsed |
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. |
Bool gf_sys_get_battery_state | ( | Bool * | onBattery, |
u32 * | onCharge, | ||
u32 * | level, | ||
u32 * | batteryLifeTime, | ||
u32 * | batteryFullLifeTime | ||
) |
GF_GlobalLock* gf_global_resource_lock | ( | const char * | resourceName | ) |
This function allows the user to create a global lock for all GPAC instances. This allow to disable some features for other instances for instance.
resourceName | The name of the resource to lock |
GF_Err gf_global_resource_unlock | ( | GF_GlobalLock * | lock | ) |
Unlock a previouly locked resource
lock | The resource to unlock |
char* gf_get_default_cache_directory | ( | ) |
Gets a newly allocated string containing the default cache directory. It is the responsibility of the caller to free the string.
Compresses a data buffer in place using zlib. Buffer may be reallocated in the process.
data | pointer to the data buffer to be compressed |
data_len | length of the data buffer to be compressed |
out_size | pointer for output buffer size |
GF_Err gf_gz_decompress_payload | ( | char * | data, |
u32 | data_len, | ||
char ** | uncompressed_data, | ||
u32 * | out_size | ||
) |
Decompresses a data buffer using zlib.
data | data buffer to be decompressed |
data_len | length of the data buffer to be decompressed |
uncompressed_data | pointer to the uncompressed data buffer. It is the responsibility of the caller to free this buffer. |
out_size | size of the uncompressed buffer |
GF_SHA1Context* gf_sha1_starts | ( | ) |
void gf_sha1_finish | ( | GF_SHA1Context * | ctx, |
u8 | digest[20] | ||
) |
int gf_sha1_file | ( | const char * | filename, |
u8 | digest[20] | ||
) |