소스 검색

* Enable gprof support

tags/0.2.7
Vsevolod Stakhov 15 년 전
부모
커밋
6cb3a85919
4개의 변경된 파일27개의 추가작업 그리고 2개의 파일을 삭제
  1. 8
    0
      CMakeLists.txt
  2. 2
    0
      config.h.in
  3. 1
    2
      src/main.c
  4. 16
    0
      src/worker.c

+ 8
- 0
CMakeLists.txt 파일 보기

OPTION(ENABLE_LUA "Enable lua support [default: OFF]" OFF) OPTION(ENABLE_LUA "Enable lua support [default: OFF]" OFF)
OPTION(SKIP_RELINK_RPATH "Skip relinking and full RPATH for the install tree" OFF) OPTION(SKIP_RELINK_RPATH "Skip relinking and full RPATH for the install tree" OFF)
OPTION(ENABLE_REDIRECTOR "Enable redirector install [default: OFF]" OFF) OPTION(ENABLE_REDIRECTOR "Enable redirector install [default: OFF]" OFF)
OPTION(ENABLE_PROFILING "Enable profiling [default: OFF]" OFF)


# Build optimized code for following CPU (default i386) # Build optimized code for following CPU (default i386)
#SET(CPU_TUNE "i686") #SET(CPU_TUNE "i686")
MESSAGE(FATAL_ERROR "libevent is required for building rspamd") MESSAGE(FATAL_ERROR "libevent is required for building rspamd")
ENDIF(NOT LIBEVENT_LIBRARY) ENDIF(NOT LIBEVENT_LIBRARY)


IF(ENABLE_PROFILING MATCHES "ON")
SET(WITH_PROFILER 1)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
ENDIF(ENABLE_PROFILING MATCHES "ON")


FIND_PATH(LIBEVENT_INCLUDE event.h PATHS /opt/include FIND_PATH(LIBEVENT_INCLUDE event.h PATHS /opt/include
/usr/include /usr/include
/usr/local/include /usr/local/include

+ 2
- 0
config.h.in 파일 보기



#cmakedefine WITH_LUA 1 #cmakedefine WITH_LUA 1


#cmakedefine WITH_PROFILER 1

#define RVERSION "${RSPAMD_VERSION}" #define RVERSION "${RSPAMD_VERSION}"
#define RSPAMD_MASTER_SITE_URL "${RSPAMD_MASTER_SITE_URL}" #define RSPAMD_MASTER_SITE_URL "${RSPAMD_MASTER_SITE_URL}"



+ 1
- 2
src/main.c 파일 보기

} }
msg_info ("main: terminating..."); msg_info ("main: terminating...");


if (rspamd->cfg->bind_family == AF_UNIX) { if (rspamd->cfg->bind_family == AF_UNIX) {
unlink (rspamd->cfg->bind_host); unlink (rspamd->cfg->bind_host);
} }

+ 16
- 0
src/worker.c 파일 보기

switch (signo) { switch (signo) {
case SIGINT: case SIGINT:
case SIGTERM: case SIGTERM:
#ifdef WITH_PROFILER
exit (0);
#else
_exit (1); _exit (1);
#endif
break; break;
} }
} }
{ {
struct sigaction signals; struct sigaction signals;
int i; int i;
#ifdef WITH_PROFILER
extern void _start (void), etext (void);
monstartup ((u_long) &_start, (u_long) &etext);
#endif
#if 0
/* Try to create temp directory for gmon.out and chdir to it */
char prof_dir[PATH_MAX];
snprintf (prof_dir, sizeof (prof_dir), "%s/rspamd-prof-%d", worker->srv->cfg->temp_dir, (int)getpid ());
if (mkdir (prof_dir, S_IRUSR | S_IWUSR | S_IXUSR | S_IXOTH | S_IROTH | S_IXGRP | S_IRGRP) != -1) {
chdir (prof_dir);
}
#endif


worker->srv->pid = getpid (); worker->srv->pid = getpid ();
worker->srv->type = TYPE_WORKER; worker->srv->type = TYPE_WORKER;

Loading…
취소
저장