trace.h 文件

用途

定义 IEEE POSIX 1003 标识的实现跟踪。

描述

<trace.h> 头定义包含以下成员的 posix_trace_event_info 结构:

trace_event_id_t          posix_event_id
pid_t                     posix_pid
void                     *posix_prog_address
int                       posix_truncation_status
struct timespec           posix_timestamp
pthread_t                 posix_thread_id

<trace.h> 头定义包含以下成员的 posix_trace_status_info 结构:

int     posix_stream_status
int     posix_stream_full_status
int     posix_stream_overrun_status
int     posix_stream_flush_status
int     posix_stream_flush_error
int     posix_log_overrun_status
int     posix_log_full_status

<trace.h> 头定义以下符号:
表 1. trace.h 头的符号
符号 用途 描述
POSIX_TRACE_ADD_EVENTSET how参数posix_trace_set_filter()函数 (function);功能

要过滤的跟踪事件类型的结果集是当前集与参数集所指向的跟踪事件类型集的并集。

POSIX_TRACE_ALL_EVENTS what参数posix_trace_eventset_fill()函数 (function);功能

所有已定义的跟踪事件类型 (包括系统和用户) 都包含在集合中。

POSIX_TRACE_APPEND logpolicy参数posix_trace_attr_setlogfullpolicy()函数 (function);功能

关联的跟踪流将清空到跟踪日志中,并且没有日志大小限制。

POSIX_TRACE_CLOSE_FOR_CHILD inheritancepolicy参数posix_trace_eventset_fill()函数 (function);功能

fork () 操作或 衍生 () 操作之后,将不会跟踪该子代,并且会继续跟踪该父代。

POSIX_TRACE_FILTER  

当跟踪事件类型过滤器发生更改时,此事件将记录在流中。

POSIX_TRACE_FLUSH streampolicy参数posix_trace_attr_setstreamfullpolicy()函数 (function);功能

此策略与 POSIX_TRACE_UNTIL_FULL 跟踪流完整策略相同,但跟踪流会定期刷新,就像已显式调用 posix_trace_flush () 操作一样。

POSIX_TRACE_FLUSH_START  

此事件将记录在流中,以标记刷新操作的开始。

POSIX_TRACE_FLUSH_STOP  

此事件将记录在标记清仓操作结束的流中。

POSIX_TRACE_FLUSHING posix_stream_flush_status成员posix_trace_status_info结构 (structure)

正在将跟踪流清空到跟踪日志。

POSIX_TRACE_FULL posix_stream_full_status成员posix_trace_status_info结构 (structure)

跟踪事件的跟踪流中的空间已用尽。

POSIX_TRACE_FULL posix_log_full_status成员posix_trace_status_info结构 (structure)

跟踪日志中的空间已耗尽。

POSIX_TRACE_LOOP streampolicy参数posix_trace_attr_setstreamfullpolicy()函数 (function);功能

跟踪流循环直到 posix_trace_stop () 子例程显式停止它。

POSIX_TRACE_LOOP logpolicy参数posix_trace_attr_setlogfullpolicy()函数 (function);功能

跟踪日志循环,直到关联的跟踪流停止。

POSIX_TRACE_NO_OVERRUN posix_stream_overrun_status成员posix_trace_status_info结构 (structure)

流中不会丢失任何跟踪事件。

POSIX_TRACE_NO_OVERRUN posix_log_overrun_status成员posix_trace_status_info结构 (structure)

跟踪日志中不会丢失任何跟踪事件。

POSIX_TRACE_NOT_FLUSHING posix_stream_flush_status成员posix_trace_status_info结构 (structure)

未在执行任何清空操作。

POSIX_TRACE_NOT_FULL posix_stream_full_status成员posix_trace_status_info结构 (structure)

在跟踪流中有可用空间。

POSIX_TRACE_NOT_FULL posix_log_full_status成员posix_trace_status_info结构 (structure)

在跟踪日志中有可用空间。

POSIX_TRACE_INHERITED inheritancepolicy参数posix_trace_attr_setinherited()函数 (function);功能

在执行 fork () 操作或 衍生 () 操作后,如果跟踪父代,那么将使用同一跟踪流同时跟踪其子代。

POSIX_TRACE_NOT_TRUNCATED posix_truncation_status成员posix_trace_event_info结构 (structure)

所有已跟踪数据都可用。

POSIX_TRACE_OVERFLOW  

此事件记录在流中,以标记跟踪溢出条件的开始。

POSIX_TRACE_OVERRUN posix_stream_overrun_status成员posix_trace_status_info结构 (structure)

至少有一个跟踪事件丢失且未记录在跟踪流中。

POSIX_TRACE_OVERRUN posix_log_overrun_status成员posix_trace_status_info结构 (structure)

至少有一个跟踪事件在跟踪日志中丢失。

POSIX_TRACE_RESUME  

此事件将记录在流中,以标记跟踪溢出条件结束。

POSIX_TRACE_RUNNING posix_stream_status成员posix_trace_status_info结构 (structure)

正在进行跟踪。

POSIX_TRACE_SET_EVENTSET how参数posix_trace_set_filter()函数 (function);功能

要过滤的跟踪事件类型的结果集是参数集所指向的跟踪事件类型集。

POSIX_TRACE_START  

此事件记录在流中的跟踪启动操作中。

POSIX_TRACE_STOP  

此事件记录在流中的跟踪停止操作中。

POSIX_TRACE_SUB_EVENTSET how参数posix_trace_set_filter()函数 (function);功能

要过滤的跟踪事件类型的结果集包括当前集合中的所有跟踪事件类型。 这些跟踪事件类型不在参数集所指向的集合中。 当前跟踪事件类型集的每个元素都将从当前过滤器中除去。

POSIX_TRACE_SUSPENDED posix_stream_status成员posix_trace_status_info结构 (structure)

跟踪操作尚未启动,或已停止。

POSIX_TRACE_SYSTEM_EVENTS what参数posix_trace_eventset_fill()函数 (function);功能

所有 system-trace-event 类型都包含在集合中。

POSIX_TRACE_TRUNCATED_READ posix_truncation_status成员posix_trace_event_info结构 (structure)

在从跟踪流或跟踪日志中读取跟踪事件时,由于阅读器的缓冲区太小,因此数据会被截断。

POSIX_TRACE_TRUNCATED_RECORD posix_truncation_status成员posix_trace_event_info结构 (structure)

在生成跟踪事件时,数据将被截断。

POSIX_TRACE_UNNAMED_USER_EVENT  

如果达到跟踪事件的每个进程的用户名,那么将在 posix_trace_eventid_open ()posix_trace_trid_eventid_open ()上返回 POSIX_TRACE_UNNAMED_USEREVENT 用户跟踪事件。

POSIX_TRACE_UNTIL_FULL streampolicy参数posix_trace_attr_getstreamfullpolicy()函数 (function);功能

跟踪流将运行直至跟踪流资源耗尽为止; 然后跟踪流将停止。

POSIX_TRACE_UNTIL_FULL logpolicy参数posix_trace_attr_getlogfullpolicy()函数 (function);功能

跟踪流将清空到跟踪日志中,直到跟踪日志已满为止。

POSIX_TRACE_WOPID_EVENTS what参数posix_trace_eventset_fill()函数 (function);功能

所有与进程无关的 system-trace-event 类型都包含在集合中。

如头 types.h 文件中所述,定义了以下类型:

跟踪属性
类型跟踪标识符
类型跟踪事件标识符
类型跟踪事件集合类型
int  posix_trace_attr_destroy(trace_attr_t *);
int  posix_trace_attr_getclockres(const trace_attr_t *,
         struct timespec *);
int  posix_trace_attr_getcreatetime(const trace_attr_t *,
         struct timespec *);
int  posix_trace_attr_getgenversion(const trace_attr_t *, char *);
int  posix_trace_attr_getinherited(const trace_attr_t *restrict,
         int *restrict);
int  posix_trace_attr_getlogfullpolicy(const trace_attr_t *restrict,
         int *restrict);
int  posix_trace_attr_getlogsize(const trace_attr_t *restrict,
         size_t *restrict);
int  posix_trace_attr_getmaxdatasize(const trace_attr_t *restrict,
         size_t *restrict);
int  posix_trace_attr_getmaxsystemeventsize(const trace_attr_t *restrict,
         size_t *restrict);
int  posix_trace_attr_getmaxusereventsize(const trace_attr_t *restrict,
         size_t, size_t *restrict);
int  posix_trace_attr_getname(const trace_attr_t *, char *);
int  posix_trace_attr_getstreamfullpolicy(const trace_attr_t *restrict,
         int *restrict);
int  posix_trace_attr_getstreamsize(const trace_attr_t *restrict,
         size_t *restrict);
int  posix_trace_attr_init(trace_attr_t *);
int  posix_trace_attr_setinherited(trace_attr_t *, int);
int  posix_trace_attr_setlogfullpolicy(trace_attr_t *, int);
int  posix_trace_attr_setlogsize(trace_attr_t *, size_t);
int  posix_trace_attr_setmaxdatasize(trace_attr_t *, size_t);
int  posix_trace_attr_setname(trace_attr_t *, const char *);
int  posix_trace_attr_setstreamsize(trace_attr_t *, size_t);
int  posix_trace_attr_setstreamfullpolicy(trace_attr_t *, int);
int  posix_trace_clear(trace_id_t);
int  posix_trace_close(trace_id_t);
int  posix_trace_create(pid_t, const trace_attr_t *restrict,
         trace_id_t *restrict);
int  posix_trace_create_withlog(pid_t, const trace_attr_t *restrict,
         int, trace_id_t *restrict);
void posix_trace_event(trace_event_id_t, const void *restrict, size_t);
int  posix_trace_eventid_equal(trace_id_t, trace_event_id_t,
         trace_event_id_t);
int  posix_trace_eventid_get_name(trace_id_t, trace_event_id_t, char *);
int  posix_trace_eventid_open(const char *restrict,
         trace_event_id_t *restrict);
int  posix_trace_eventset_add(trace_event_id_t, trace_event_set_t *);
int  posix_trace_eventset_del(trace_event_id_t, trace_event_set_t *);
int  posix_trace_eventset_empty(trace_event_set_t *);
int  posix_trace_eventset_fill(trace_event_set_t *, int);
int  posix_trace_eventset_ismember(trace_event_id_t,
         const trace_event_set_t *restrict, int *restrict);
int  posix_trace_eventtypelist_getnext_id(trace_id_t,
         trace_event_id_t *restrict, int *restrict);
int  posix_trace_eventtypelist_rewind(trace_id_t);
int  posix_trace_flush(trace_id_t);
int  posix_trace_get_attr(trace_id_t, trace_attr_t *);
int  posix_trace_get_filter(trace_id_t, trace_event_set_t *);
int  posix_trace_get_status(trace_id_t,
         struct posix_trace_status_info *);
int  posix_trace_getnext_event(trace_id_t,
         struct posix_trace_event_info *restrict , void *restrict,
         size_t, size_t *restrict, int *restrict);
int  posix_trace_open(int, trace_id_t *);
int  posix_trace_rewind(trace_id_t);
int  posix_trace_set_filter(trace_id_t, const trace_event_set_t *, int);
int  posix_trace_shutdown(trace_id_t);
int  posix_trace_start(trace_id_t);
int  posix_trace_stop(trace_id_t);
int  posix_trace_timedgetnext_event(trace_id_t,
         struct posix_trace_event_info *restrict, void *restrict,
         size_t, size_t *restrict, int *restrict,
         const struct timespec *restrict);
int  posix_trace_trid_eventid_open(trace_id_t, const char *restrict,
          trace_event_id_t *restrict);
int  posix_trace_trygetnext_event(trace_id_t,
          struct posix_trace_event_info *restrict, void *restrict, size_t,
          size_t *restrict, int *restrict);