Skip to content

Commit

Permalink
code: smooth
Browse files Browse the repository at this point in the history
  • Loading branch information
HardySimpson committed Jul 6, 2012
1 parent b28a40b commit e4dd43f
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 26 deletions.
2 changes: 1 addition & 1 deletion doc/UsersGuide-CN.lyx
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,7 @@ reference "ite:同步IO文件"
\end_layout

\begin_layout Standard
(level int)必须在[1,253]这个范围内,越大越着重要。(syslog level)是可选的,如果不设默认为LOG_DEBUG。
(level int)必须在[1,253]这个范围内,越大越重要。(syslog level)是可选的,如果不设默认为LOG_DEBUG。
\end_layout

\begin_layout Standard
Expand Down
4 changes: 2 additions & 2 deletions doc/performence.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
using makefile.linux for test, libzlog compile in O2
-------------------------------------------------
[direct write, no logging library] - The Sky!
$ time ./test_press_printf 1 10 100000
$ time ./test_press_fwrite 1 10 100000
real 0m0.227s
user 0m0.070s
sys 0m0.180s

$ time ./test_press_printf2 1 10 100000
$ time ./test_press_fwrite2 1 10 100000
real 0m0.123s
user 0m0.060s
sys 0m0.130s
Expand Down
25 changes: 10 additions & 15 deletions libzlog/buf.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#define __zlog_buf_h

#include <stdarg.h>
#include <time.h>
#include <stdint.h>

typedef struct zlog_buf_s {
Expand All @@ -38,11 +37,19 @@ typedef struct zlog_buf_s {
size_t truncate_str_len;
} zlog_buf_t;

zlog_buf_t *zlog_buf_new(size_t buf_size_min, size_t buf_size_max,
const char *truncate_str);

zlog_buf_t *zlog_buf_new(size_t min, size_t max, const char *truncate_str);
void zlog_buf_del(zlog_buf_t * a_buf);
void zlog_buf_profile(zlog_buf_t * a_buf, int flag);

int zlog_buf_vprintf(zlog_buf_t * a_buf, const char *format, va_list args);
int zlog_buf_append(zlog_buf_t * a_buf, const char *str, size_t str_len);
int zlog_buf_adjust_append(zlog_buf_t * a_buf, const char *str, size_t str_len,
int left_adjust, size_t in_width, size_t out_width);
int zlog_buf_printf_dec32(zlog_buf_t * a_buf, uint32_t ui32, int width);
int zlog_buf_printf_dec64(zlog_buf_t * a_buf, uint64_t ui64, int width);
int zlog_buf_printf_hex(zlog_buf_t * a_buf, uint32_t ui32, int width);

#define zlog_buf_restart(a_buf) do { \
a_buf->tail = a_buf->start; \
} while(0)
Expand All @@ -51,16 +58,4 @@ void zlog_buf_profile(zlog_buf_t * a_buf, int flag);
#define zlog_buf_str(a_buf) (a_buf->start)
#define zlog_buf_seal(a_buf) do {*(a_buf)->tail = '\0';} while (0)

int zlog_buf_vprintf(zlog_buf_t * a_buf, const char *format, va_list args);
int zlog_buf_append(zlog_buf_t * a_buf, const char *str, size_t str_len);

int zlog_buf_adjust_append(zlog_buf_t * a_buf, const char *str, size_t str_len,
int left_adjust, size_t min_width, size_t max_width);

int zlog_buf_printf_num(zlog_buf_t * a_buf, uint64_t ui64, int is_hex, int width);

int zlog_buf_printf_dec32(zlog_buf_t * a_buf, uint32_t ui32, int width);
int zlog_buf_printf_dec64(zlog_buf_t * a_buf, uint64_t ui64, int width);
int zlog_buf_printf_hex(zlog_buf_t * a_buf, uint32_t ui32, int width);

#endif
1 change: 0 additions & 1 deletion libzlog/category.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ int zlog_category_update_rules(zlog_category_t * a_category, zc_arraylist_t * ne
void zlog_category_commit_rules(zlog_category_t * a_category);
void zlog_category_rollback_rules(zlog_category_t * a_category);


int zlog_category_output(zlog_category_t * a_category, zlog_thread_t * a_thread);

#define zlog_category_needless_level(a_category, lv) \
Expand Down
1 change: 0 additions & 1 deletion libzlog/category_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ zc_hashtable_t *zlog_category_table_new(void);
void zlog_category_table_del(zc_hashtable_t * categories);
void zlog_category_table_profile(zc_hashtable_t * categories, int flag);


/* if none, create new and return */
zlog_category_t *zlog_category_table_fetch_category(
zc_hashtable_t * categories,
Expand Down
8 changes: 4 additions & 4 deletions test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ noinst_PROGRAMS = \
test_press_zlog \
test_press_zlog2 \
test_press_syslog \
test_press_printf \
test_press_printf2 \
test_press_fwrite \
test_press_fwrite2 \
test_syslog \
test_conf \
test_mdc \
Expand All @@ -38,8 +38,8 @@ test_hex_SOURCES = test_hex.c
test_init_SOURCES = test_init.c
test_press_zlog_SOURCES = test_press_zlog.c
test_press_zlog2_SOURCES = test_press_zlog2.c
test_press_printf_SOURCES = test_press_printf.c
test_press_printf2_SOURCES = test_press_printf2.c
test_press_fwrite_SOURCES = test_press_fwrite.c
test_press_fwrite2_SOURCES = test_press_fwrite2.c
test_press_syslog_SOURCES = test_press_syslog.c
test_syslog_SOURCES = test_syslog.c
test_mdc_SOURCES = test_mdc.c
Expand Down
4 changes: 2 additions & 2 deletions test/makefile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ exe = \
test_record \
test_press_zlog \
test_press_zlog2 \
test_press_printf \
test_press_printf2 \
test_press_fwrite \
test_press_fwrite2 \
test_press_syslog \
test_syslog \
test_default \
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit e4dd43f

Please sign in to comment.