21 #define DPTLOG_FAILED (-1) 22 #define DPTLOG_SUCCESS (0) 26 #define DPTLOG_DELIMITER_DEFAULT (char *)" " 57 #define DPTLOG_LOCK(mng) DPUTIL_LOCK(mng->lock) 58 #define DPTLOG_UNLOCK DPUTIL_UNLOCK; 69 clock_gettime(CLOCK_REALTIME, &data->
time);
87 size_t size =
sizeof(*mng);
88 void * current_p=NULL;
95 size += (maxloglen + 1) * (maxstoresize + 1);
102 memset(mng, 0, size);
115 mng->
lock = malloc(
sizeof(pthread_mutex_t));
116 pthread_mutex_init(mng->
lock, NULL);
124 current_p = mng->
log_list + maxstoresize;
127 for( i = 0; i < maxstoresize; i++ ) {
141 if(!mng || !format) {
148 va_start(arg, format);
168 pthread_mutex_t *lock=NULL;
pthread_mutex_t * lock
delimiter
int dp_timelog_print(DPTimeLog mng, const char *format,...)
Store log.
static void dp_timelog_show(DPTimeLog mng)
DPTimeLog dp_timelog_init(const char *delimiter, size_t maxloglen, unsigned long maxstoresize, int is_threadsafe)
Init store log.
Utility mutex API for design pattern.
unsigned long maxstoresize
numnber of current stored log
void dp_timelog_exit(DPTimeLog mng)
Exit stored log, and show stored log.
void(* free)(EventInstance this)
struct dp_timelog_data_t dp_timelog_data_t
log data with timestamp, defined like class
unsigned long current_num
dp_timelog_data_t * log_list
max size of log_list
#define DPTLOG_DELIMITER_DEFAULT
default delimiter definition
DPTimeLog timelog_g
Implement of dp_timelog API, defined in dp_debug.h.
#define DEBUG_ERRPRINT(...)
storaged log data management structure
static void dp_timelog_data_store(DPTimeLog mng)
for dp_timelog_data_t