Commit ee8781f7 authored by Michael Cook's avatar Michael Cook

Support for using gprof profiling

parent 7d0497ca
......@@ -177,9 +177,13 @@ set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -Wno-packed-bitfield-compat -fPIC -Wall -fno-strict-aliasing -rdynamic -std=c++11 -D${MKVER}"
)
#set(SANITIZER "-fsanitize=address")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZER}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZER}")
# Uncomment these lines to enable the address sanitizer
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
# Uncomment these lines to enable gprof profiling
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg -DUSING_GPROF")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg -DUSING_GPROF")
add_definitions("-DASN_DISABLE_OER_SUPPORT")
......
......@@ -95,6 +95,9 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "NB_IoT_interface.h"
#include <executables/split_headers.h>
#if USING_GPROF
# include "sys/gmon.h"
#endif
pthread_cond_t nfapi_sync_cond;
pthread_mutex_t nfapi_sync_mutex;
......@@ -738,6 +741,14 @@ int main ( int argc, char **argv )
if(IS_SOFTMODEM_DOFORMS)
load_softscope("enb");
itti_wait_tasks_end();
#if USING_GPROF
// Save the gprof data now (rather than via atexit) in case we crash while shutting down
fprintf(stderr, "Recording gprof data...\n");
_mcleanup();
fprintf(stderr, "Recording gprof data...done\n");
#endif // USING_GPROF
oai_exit=1;
LOG_I(ENB_APP,"oai_exit=%d\n",oai_exit);
// stop threads
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment