文件操作逻辑升级

#1 性能优化
1、句柄中存储文件句柄,无需每次打开
2、完善demo中的性能测试场景

单机测试硬件(OS:CentOS Linux release 7.4.1708, CPU:Intel E5 2640 v4 2.4GHz, Disk:ST600MM0208 600G)
30线程每线程循环写入10w条日志,耗时380448us,平均日志写入速度788544条/s,日志平均长度104Byte/条,折合写入磁盘速度为78.8MB/s
This commit is contained in:
dump2file
2019-02-18 17:50:44 +08:00
parent 6c8af75e99
commit e63b7ee385
3 changed files with 95 additions and 67 deletions

View File

@@ -3,6 +3,11 @@ VPATH=../inc
CFLAGS= -g3 -Wall -fPIC -O -Werror
CFLAGS+=-I../inc/
ifdef ASAN
CFLAGS_+= -fsanitize=address -fno-omit-frame-pointer
LIB+=-lasan
endif
SRC=MESA_handle_logger.c
OBJS=$(SRC:.c=.o)
@@ -15,7 +20,7 @@ libMESA_handle_logger.a:$(OBJS)
ar cqs $@ $<
libMESA_handle_logger.so:$(OBJS)
$(CC) $(CFLAGS) -shared $< -o $@
$(CC) $(CFLAGS) $(LIB) -shared $< -o $@
.c.o:
#$(OBJS):$(SRC)