System time and CPU functions.
More...
Typedefs |
typedef struct
_GF_GlobalLock_opaque | GF_GlobalLock |
typedef struct __sha1_context | GF_SHA1Context |
Functions |
void | gf_sys_init (Bool enable_memory_tracker) |
| System setup.
|
void | gf_sys_close () |
| System closing.
|
u32 | gf_sys_clock () |
| System clock query.
|
void | gf_sleep (u32 ms) |
| Sleeps thread/process.
|
GF_Err | gf_rmdir (char *DirPathName) |
| Delete Directory.
|
GF_Err | gf_mkdir (char *DirPathName) |
| Create Directory.
|
GF_Err | gf_cleanup_dir (char *DirPathName) |
| Create Directory.
|
u32 | gf_crc_32 (char *data, u32 size) |
| CRC32 compute.
|
Bool | gf_sys_get_rti (u32 refresh_time_ms, GF_SystemRTInfo *rti, u32 flags) |
| Gets Run-Time info.
|
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]) |
Detailed Description
*This section documents time functionalities and CPU management in GPAC.
Enumeration Type Documentation
Selection flags for run-time info retrieval
- Enumerator:
GF_RTI_ALL_PROCESSES_TIMES |
Indicates all processes' times must be fetched. If not set, only the current process times will be retrieved, and the thread count and total times won't be available
|
GF_RTI_PROCESS_MEMORY |
Indicates the process allocated heap size must be fetch. If not set, only the system physical memory is fetched. Fetching the entire ocess allocated memory can have a large impact on performances
|
GF_RTI_SYSTEM_MEMORY_ONLY |
Indicates that only system memory should be fetched. When set, all refreshing info is ignored
|
Function Documentation
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.
- Note:
- This can be called several times but only the first call will result in system setup.
Closes the system high-resolution clock and any CPU associated ressources.
- Note:
- This can be called several times but the system will be closed when no more users are counted.
Gets the system clock time.
- Returns:
- System clock value since initialization in milliseconds.
Locks calling thread/process execution for a given time.
- Parameters:
-
ms | Amount of time to sleep in milliseconds. |
GF_Err gf_rmdir |
( |
char * |
DirPathName | ) |
|
Delete a dir within the full path.
- Parameters:
-
DirPathName | the file path name. |
GF_Err gf_mkdir |
( |
char * |
DirPathName | ) |
|
Create a directory within the full path.
- Parameters:
-
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.
- Parameters:
-
DirPathName | the dir path name. |
u32 gf_crc_32 |
( |
char * |
data, |
|
|
u32 |
size |
|
) |
| |
Computes the CRC32 value of a buffer.
- Parameters:
-
data | buffer |
size | buffer size |
- Returns:
- computed CRC32
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.
- Parameters:
-
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. |
- Returns:
- 1 if info has been updated, 0 otherwise.
- Note:
- You should not try to use a too small refresh time. Typical values are 500 ms or one second.
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.
- Parameters:
-
resourceName | The name of the resource to lock |
- Returns:
- false if resource has been locked, true if resource could not be locked
GF_Err gf_global_resource_unlock |
( |
GF_GlobalLock * |
lock | ) |
|
Unlock a previouly locked resource
- Parameters:
-
lock | The resource to unlock |
- Returns:
- GF_OK if evertything went fine
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.
- Returns:
- a fully qualified path to the default cache directory
GF_Err gf_gz_compress_payload |
( |
char ** |
data, |
|
|
u32 |
data_len, |
|
|
u32 * |
out_size |
|
) |
| |
Compresses a data buffer in place using zlib. Buffer may be reallocated in the process.
- Parameters:
-
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 |
- Returns:
- GF_OK if evertything went fine
GF_Err gf_gz_decompress_payload |
( |
char * |
data, |
|
|
u32 |
data_len, |
|
|
char ** |
uncompressed_data, |
|
|
u32 * |
out_size |
|
) |
| |
Decompresses a data buffer using zlib.
- Parameters:
-
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 |
- Returns:
- GF_OK if evertything went fine