library/src/os_profiling/BP_OSProfiling.cc
// Create a new empty osprof_session suitable for os profiling.
Create a new empty osprof_session suitable for os profiling.
Create a new empty osprof_session suitable for os profiling .
P_BP_OS_PROFILING_SESSION BP_CreateNewOSProfiler()
{
	if(!global_osprof_session)
	{
		global_osprof_session = (P_BP_OS_PROFILING_SESSION) bpcalloc(sizeof(BP_OS_PROFILING_SESSION), 1);
	}
	else
	{
		printf("\n [+] Return OSProf singleton");
		return global_osprof_session;
	}
	if(!global_osprof_session)
		return NULL;
	sem_init(&global_osprof_session->lock, 1, 1);
	sg_init(0);
	global_osprof_session->m = BP_CreateLinkL("OS Profiling Memory Allocator", BP_TRUE);
	global_osprof_session->initialized = P_BP_OS_PROFILING_SESSION_INITIALIZED;
	os_profiler_already_created_once = 1;
	printf("\n [+] Global OS Profiler Created Successfully.");
	return global_osprof_session;
}
P_BP_OS_PROFILING_SESSION BP_CreateNewOSProfiler ( ) { if ( ! global_osprof_session ) { global_osprof_session = ( P_BP_OS_PROFILING_SESSION ) bpcalloc ( sizeof ( BP_OS_PROFILING_SESSION ) , 1 ) ; } else { printf ( " \n " ) ; return global_osprof_session ; } if ( ! global_osprof_session ) return NULL ; sem_init ( & global_osprof_session -> lock , 1 , 1 ) ; sg_init ( 0 ) ; global_osprof_session -> m = BP_CreateLinkL ( " " , BP_TRUE ) ; global_osprof_session -> initialized = P_BP_OS_PROFILING_SESSION_INITIALIZED ; os_profiler_already_created_once = 1 ; printf ( " \n " ) ; return global_osprof_session ; }
Create a new empty osprof_session suitable for os profiling.
Create a new empty osprof_session suitable for os profiling .
// create new osprof_session structure // memset(global_osprof_session->lock, 0x00, sizeof(sem_t)); // check for a osprof_session // initialize the osprof_session semaphore // init statgrab library // create a new thread safe allocator // set initialized flag // set flag // display creation message // return the osprof_session