RT-Thread RTOS  1.0.0
An open source embedded real-time operating system
Runtime Trace and Record

Functions

void rt_thread_idle_sethook (void(*hook)())
void rt_malloc_sethook (void(*hook)(void *ptr, rt_size_t size))
void rt_free_sethook (void(*hook)(void *ptr))
void rt_mp_alloc_sethook (void(*hook)(struct rt_mempool *mp, void *block))
void rt_mp_free_sethook (void(*hook)(struct rt_mempool *mp, void *block))
void rt_module_load_sethook (void(*hook)(rt_module_t module))
void rt_module_unload_sethook (void(*hook)(rt_module_t module))
void rt_object_attach_sethook (void(*hook)(struct rt_object *object))
void rt_object_detach_sethook (void(*hook)(struct rt_object *object))
void rt_object_trytake_sethook (void(*hook)(struct rt_object *object))
void rt_object_take_sethook (void(*hook)(struct rt_object *object))
void rt_object_put_sethook (void(*hook)(struct rt_object *object))
void rt_scheduler_sethook (void(*hook)(struct rt_thread *from, struct rt_thread *to))
void rt_timer_timeout_sethook (void(*hook)(struct rt_timer *timer))

Detailed Description

In order to trace and record RT-Thread activity in runtime, a hook mechanism is introduced.

The hooks are a series of routines, which are invoked in some special checkpoints. The hook routines include:


Function Documentation

void rt_thread_idle_sethook ( void(*)()  hook)

This function will set a hook function to idle thread loop.

Parameters:
hookthe specified hook function
Note:
the hook function must be simple and never be blocked or suspend.
void rt_malloc_sethook ( void(*)(void *ptr, rt_size_t size)  hook)

This function will set a hook function, which will be invoked when a memory block is allocated from heap memory.

Parameters:
hookthe hook function
void rt_free_sethook ( void(*)(void *ptr)  hook)

This function will set a hook function, which will be invoked when a memory block is released to heap memory.

Parameters:
hookthe hook function
void rt_mp_alloc_sethook ( void(*)(struct rt_mempool *mp, void *block)  hook)

This function will set a hook function, which will be invoked when a memory block is allocated from memory pool.

Parameters:
hookthe hook function
void rt_mp_free_sethook ( void(*)(struct rt_mempool *mp, void *block)  hook)

This function will set a hook function, which will be invoked when a memory block is released to memory pool.

Parameters:
hookthe hook function
void rt_module_load_sethook ( void(*)(rt_module_t module)  hook)

This function will set a hook function, which will be invoked when module be loaded to system.

Parameters:
hookthe hook function
void rt_module_unload_sethook ( void(*)(rt_module_t module)  hook)

This function will set a hook function, which will be invoked when module be unloaded from system.

Parameters:
hookthe hook function
void rt_object_attach_sethook ( void(*)(struct rt_object *object)  hook)

This function will set a hook function, which will be invoked when object attaches to kernel object system.

Parameters:
hookthe hook function
void rt_object_detach_sethook ( void(*)(struct rt_object *object)  hook)

This function will set a hook function, which will be invoked when object detaches from kernel object system.

Parameters:
hookthe hook function
void rt_object_trytake_sethook ( void(*)(struct rt_object *object)  hook)

This function will set a hook function, which will be invoked when object is taken from kernel object system.

The object is taken means: semaphore - semaphore is taken by thread mutex - mutex is taken by thread event - event is received by thread mailbox - mail is received by thread message queue - message is received by thread

Parameters:
hookthe hook function
void rt_object_take_sethook ( void(*)(struct rt_object *object)  hook)

This function will set a hook function, which will be invoked when object have been taken from kernel object system.

The object have been taken means: semaphore - semaphore have been taken by thread mutex - mutex have been taken by thread event - event have been received by thread mailbox - mail have been received by thread message queue - message have been received by thread timer - timer is started

Parameters:
hookthe hook function
void rt_object_put_sethook ( void(*)(struct rt_object *object)  hook)

This function will set a hook function, which will be invoked when object is put to kernel object system.

Parameters:
hookthe hook function
void rt_scheduler_sethook ( void(*)(struct rt_thread *from, struct rt_thread *to)  hook)

This function will set a hook function, which will be invoked when thread switch happens.

Parameters:
hookthe hook function
void rt_timer_timeout_sethook ( void(*)(struct rt_timer *timer)  hook)

This function will set a hook function, which will be invoked when timer is timeout.

Parameters:
hookthe hook function
 All Data Structures Variables