Skip to content

Commit

Permalink
optimize: cache static file's descriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
HardySimpson committed Jun 13, 2012
1 parent 194998b commit b27c33d
Show file tree
Hide file tree
Showing 14 changed files with 379 additions and 146 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ missing
stamp-h1
tags
zlog-chk-conf
zlog-gen-conf
zlog-*.tar.gz
zlog.pc
press.log*
callgrind*
err.log
test_*
Expand All @@ -42,4 +41,4 @@ doc/*.pdf
doc/obj.think
doc/zlog.3
doc/zlogtest.xls
zlog-*.tar.gz
test/press*
1 change: 1 addition & 0 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
[o] 基于日志笔数自动刷新配置
[o] 基于日志笔数自动做sync到硬盘操作
--- 1.0.3 ---
[o] 缓存静态文件的fd,优化

[p] 使用valgrind测试性能
[ ] 增加man age, df, 案例
Expand Down
2 changes: 1 addition & 1 deletion devconf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

# from configure,Makefile.am->Makefile, developer use

CFLAGS="-Wall -Werror -g -O2 -std=c99" ./configure --prefix=/opt/develop/ --enable-test
CFLAGS="-Wall -Werror -g -O0 -std=c99" ./configure --prefix=/opt/develop/ --enable-test
1 change: 1 addition & 0 deletions libzlog/rotater.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ int zlog_rotater_rotate(zlog_rotater_t *a_rotater,
rc = -1;
goto zlog_rotater_rotate_exit;
} else if (rc == 0) {
rc = 1;
zc_debug("zlog_rotater_file_ls_mv success");
}

Expand Down
7 changes: 7 additions & 0 deletions libzlog/rotater.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ typedef struct zlog_rotater_s zlog_rotater_t;

zlog_rotater_t *zlog_rotater_new(char *lock_file);
void zlog_rotater_del(zlog_rotater_t *a_rot);

/*
* return
* -1 fail
* 0 no rotate
* 1 rotate and success
*/
int zlog_rotater_rotate(zlog_rotater_t *a_rot,
char *file_path, long file_max_size, int file_max_count,
size_t msg_len);
Expand Down
Loading

0 comments on commit b27c33d

Please sign in to comment.