gms_profiler插件根据检视意见修改
This commit is contained in:
@ -24,6 +24,7 @@ set(CMAKE_MODULE_PATH
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gc_fdw
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ndpplugin
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spq_plugin
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gms_profiler
|
||||
)
|
||||
|
||||
add_subdirectory(hstore)
|
||||
@ -48,3 +49,4 @@ add_subdirectory(ndpplugin)
|
||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/spq_plugin)
|
||||
add_subdirectory(spq_plugin)
|
||||
endif()
|
||||
add_subdirectory(gms_profiler)
|
||||
|
||||
@ -56,7 +56,8 @@ SUBDIRS = \
|
||||
unaccent \
|
||||
vacuumlo \
|
||||
security_plugin \
|
||||
ndpplugin
|
||||
ndpplugin \
|
||||
gms_profiler
|
||||
|
||||
ifeq ($(with_openssl),yes)
|
||||
SUBDIRS += sslinfo
|
||||
|
||||
24
contrib/gms_profiler/CMakeLists.txt
Normal file
24
contrib/gms_profiler/CMakeLists.txt
Normal file
@ -0,0 +1,24 @@
|
||||
#This is the main CMAKE for build all gms_profiler.
|
||||
# gms_profiler.so
|
||||
|
||||
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} TGT_gms_profiler_SRC)
|
||||
|
||||
SET(TGT_gms_profiler_INC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
set(gms_profiler_DEF_OPTIONS ${MACRO_OPTIONS} -DNDP_CLIENT -DGlobalCache)
|
||||
set(gms_profiler_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${LIB_SECURE_OPTIONS} ${CHECK_OPTIONS})
|
||||
set(gms_profiler_LINK_OPTIONS ${LIB_LINK_OPTIONS})
|
||||
|
||||
add_shared_libtarget(gms_profiler TGT_gms_profiler_SRC TGT_gms_profiler_INC "${gms_profiler_DEF_OPTIONS}" "${gms_profiler_COMPILE_OPTIONS}" "${gms_profiler_LINK_OPTIONS}")
|
||||
set_target_properties(gms_profiler PROPERTIES PREFIX "")
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gms_profiler.control
|
||||
DESTINATION share/postgresql/extension/
|
||||
)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gms_profiler--1.0.sql
|
||||
DESTINATION share/postgresql/extension/
|
||||
)
|
||||
|
||||
install(TARGETS gms_profiler DESTINATION lib/postgresql)
|
||||
@ -5,17 +5,25 @@
|
||||
|
||||
CREATE SCHEMA gms_profiler;
|
||||
|
||||
CREATE or REPLACE FUNCTION gms_profiler.start_profiler(IN run_comment varchar2 DEFAULT '', IN run_comment1 varchar2 DEFAULT '')
|
||||
returns binary_integer
|
||||
CREATE or REPLACE FUNCTION gms_profiler.start_profiler(IN run_comment varchar2 DEFAULT '', IN run_comment1 varchar2 DEFAULT '', OUT run_result binary_integer)
|
||||
AS 'MODULE_PATHNAME', 'start_profiler'
|
||||
LANGUAGE C VOLATILE NOT FENCED;
|
||||
|
||||
CREATE or REPLACE FUNCTION gms_profiler.start_profiler_1(IN run_comment varchar2 DEFAULT '', IN run_comment1 varchar2 DEFAULT '')
|
||||
returns void
|
||||
AS 'MODULE_PATHNAME', 'start_profiler_1'
|
||||
LANGUAGE C VOLATILE NOT FENCED;
|
||||
|
||||
CREATE or REPLACE FUNCTION gms_profiler.start_profiler_ext(IN run_comment varchar2 DEFAULT '' ,
|
||||
IN run_comment1 varchar2 DEFAULT '', OUT run_number binary_integer, OUT run_result binary_integer)
|
||||
returns record
|
||||
AS 'MODULE_PATHNAME', 'start_profiler_ext'
|
||||
LANGUAGE C VOLATILE NOT FENCED;
|
||||
|
||||
CREATE or REPLACE FUNCTION gms_profiler.start_profiler_ext_1(IN run_comment varchar2 DEFAULT '' ,
|
||||
IN run_comment1 varchar2 DEFAULT '', OUT run_number binary_integer)
|
||||
AS 'MODULE_PATHNAME', 'start_profiler_ext_1'
|
||||
LANGUAGE C VOLATILE NOT FENCED;
|
||||
|
||||
CREATE or REPLACE FUNCTION gms_profiler.stop_profiler()
|
||||
returns binary_integer
|
||||
AS 'MODULE_PATHNAME', 'stop_profiler'
|
||||
|
||||
@ -26,7 +26,9 @@
|
||||
PG_MODULE_MAGIC;
|
||||
|
||||
PG_FUNCTION_INFO_V1(start_profiler);
|
||||
PG_FUNCTION_INFO_V1(start_profiler_1);
|
||||
PG_FUNCTION_INFO_V1(start_profiler_ext);
|
||||
PG_FUNCTION_INFO_V1(start_profiler_ext_1);
|
||||
PG_FUNCTION_INFO_V1(stop_profiler);
|
||||
PG_FUNCTION_INFO_V1(flush_data);
|
||||
PG_FUNCTION_INFO_V1(pause_profiler);
|
||||
@ -1125,6 +1127,16 @@ Datum start_profiler(PG_FUNCTION_ARGS)
|
||||
PG_RETURN_INT32(result);
|
||||
}
|
||||
|
||||
Datum start_profiler_1(PG_FUNCTION_ARGS)
|
||||
{
|
||||
uint32 runid = 0;
|
||||
int result;
|
||||
|
||||
result = start_profiler_internal(fcinfo, &runid);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
}
|
||||
|
||||
Datum start_profiler_ext(PG_FUNCTION_ARGS)
|
||||
{
|
||||
uint32 runid = 0;
|
||||
@ -1138,6 +1150,19 @@ Datum start_profiler_ext(PG_FUNCTION_ARGS)
|
||||
return make_profiler_result(0, result);
|
||||
}
|
||||
|
||||
Datum start_profiler_ext_1(PG_FUNCTION_ARGS)
|
||||
{
|
||||
uint32 runid = 0;
|
||||
int result;
|
||||
|
||||
result = start_profiler_internal(fcinfo, &runid);
|
||||
|
||||
if (result == PROFILER_ERROR_OK)
|
||||
PG_RETURN_INT32(runid);
|
||||
else
|
||||
PG_RETURN_INT32(0);
|
||||
}
|
||||
|
||||
Datum stop_profiler(PG_FUNCTION_ARGS)
|
||||
{
|
||||
ProfilerContext *profiler_cxt = get_session_context();
|
||||
|
||||
@ -86,7 +86,9 @@ typedef struct ProfilerUnitHashEntry
|
||||
* External declarations
|
||||
*/
|
||||
extern "C" Datum start_profiler(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum start_profiler_1(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum start_profiler_ext(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum start_profiler_ext_1(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum stop_profiler(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum flush_data(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum pause_profiler(PG_FUNCTION_ARGS);
|
||||
|
||||
Reference in New Issue
Block a user