[rocprofiler-systems] Improve rocpd writing speed (#2061)

Cette révision appartient à :
Milan Radosavljevic
2025-12-03 13:11:15 +01:00
révisé par GitHub
Parent 09fbf08b40
révision 09a9f9e31d
5 fichiers modifiés avec 27 ajouts et 22 suppressions
+1 -1
Voir le fichier
@@ -78,7 +78,7 @@
url = https://github.com/jrmadsen/pybind11.git url = https://github.com/jrmadsen/pybind11.git
[submodule "projects/rocprofiler-systems/external/sqlite"] [submodule "projects/rocprofiler-systems/external/sqlite"]
path = projects/rocprofiler-systems/external/sqlite path = projects/rocprofiler-systems/external/sqlite
url = https://github.com/sqlite/sqlite url = https://github.com/sqlite/sqlite.git
[submodule "projects/rocprofiler-systems/examples/openmp/external/ompvv"] [submodule "projects/rocprofiler-systems/examples/openmp/external/ompvv"]
path = projects/rocprofiler-systems/examples/openmp/external/ompvv path = projects/rocprofiler-systems/examples/openmp/external/ompvv
url = https://github.com/OpenMP-Validation-and-Verification/OpenMP_VV.git url = https://github.com/OpenMP-Validation-and-Verification/OpenMP_VV.git
+3 -2
Voir le fichier
@@ -236,9 +236,10 @@ rocprofiler_systems_add_option(ROCPROFSYS_BUILD_CODECOV "Build for code coverage
rocprofiler_systems_add_option(ROCPROFSYS_INSTALL_PERFETTO_TOOLS rocprofiler_systems_add_option(ROCPROFSYS_INSTALL_PERFETTO_TOOLS
"Install perfetto tools (i.e. traced, perfetto, etc.)" OFF "Install perfetto tools (i.e. traced, perfetto, etc.)" OFF
) )
rocprofiler_systems_add_option(ROCPROFILER_BUILD_SQLITE3 rocprofiler_systems_add_option(ROCPROFSYS_BUILD_SQLITE3
"Enable building sqlite3 library internally" OFF "Enable building sqlite3 library internally" ON
) )
rocprofiler_systems_add_option(ROCPROFSYS_BUILD_GTEST rocprofiler_systems_add_option(ROCPROFSYS_BUILD_GTEST
"Enable building googletest library internally" ON "Enable building googletest library internally" ON
) )
+21 -16
Voir le fichier
@@ -1,6 +1,6 @@
include_guard(GLOBAL) include_guard(GLOBAL)
if(ROCPROFILER_BUILD_SQLITE3) if(ROCPROFSYS_BUILD_SQLITE3)
message(STATUS "Building SQLite3 from source!") message(STATUS "Building SQLite3 from source!")
execute_process( execute_process(
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/external/sqlite COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/external/sqlite
@@ -16,29 +16,34 @@ if(ROCPROFILER_BUILD_SQLITE3)
find_program(MAKE_COMMAND NAMES make gmake PATH_SUFFIXES bin REQUIRED) find_program(MAKE_COMMAND NAMES make gmake PATH_SUFFIXES bin REQUIRED)
include(ExternalProject) set(SQLITE_BUILD_DIR ${PROJECT_BINARY_DIR}/external/sqlite/build)
ExternalProject_Add( set(SQLITE_INSTALL_DIR ${PROJECT_BINARY_DIR}/external/sqlite/install)
rocprofiler-systems-sqlite-build set(SQLITE_LIB ${SQLITE_INSTALL_DIR}/lib/libsqlite3.a)
PREFIX ${PROJECT_BINARY_DIR}/external/sqlite/build
SOURCE_DIR ${PROJECT_SOURCE_DIR}/external/sqlite add_custom_command(
BUILD_IN_SOURCE 0 OUTPUT ${SQLITE_LIB}
CONFIGURE_COMMAND COMMAND ${CMAKE_COMMAND} -E make_directory ${SQLITE_BUILD_DIR}
<SOURCE_DIR>/configure --prefix=${PROJECT_BINARY_DIR}/external/sqlite/install COMMAND
--libdir=${PROJECT_BINARY_DIR}/external/sqlite/install/lib --disable-shared ${CMAKE_COMMAND} -E chdir ${SQLITE_BUILD_DIR}
--with-tempstore=yes --enable-all --disable-tcl CFLAGS=-O3\ -g1 ${PROJECT_SOURCE_DIR}/external/sqlite/configure --prefix=${SQLITE_INSTALL_DIR}
BUILD_COMMAND ${MAKE_COMMAND} install -s --libdir=${SQLITE_INSTALL_DIR}/lib --disable-shared --with-tempstore=yes
INSTALL_COMMAND "" --enable-all --disable-tcl
CFLAGS=-O3\ -g1\ -fPIC\ -DSQLITE_DEFAULT_MEMSTATUS=0
COMMAND ${CMAKE_COMMAND} -E chdir ${SQLITE_BUILD_DIR} ${MAKE_COMMAND} install -s
COMMENT "Building SQLite3 from source"
VERBATIM
) )
add_custom_target(rocprofiler-systems-sqlite-build DEPENDS ${SQLITE_LIB})
target_link_libraries( target_link_libraries(
rocprofiler-systems-sqlite3 rocprofiler-systems-sqlite3
INTERFACE INTERFACE $<BUILD_INTERFACE:${SQLITE_LIB}>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/external/sqlite/install/lib/libsqlite3.a>
) )
target_include_directories( target_include_directories(
rocprofiler-systems-sqlite3 rocprofiler-systems-sqlite3
SYSTEM SYSTEM
INTERFACE $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/external/sqlite/install/include> INTERFACE $<BUILD_INTERFACE:${SQLITE_INSTALL_DIR}/include>
) )
add_dependencies(rocprofiler-systems-sqlite3 rocprofiler-systems-sqlite-build) add_dependencies(rocprofiler-systems-sqlite3 rocprofiler-systems-sqlite-build)
else() else()
+1 -3
Voir le fichier
@@ -34,7 +34,6 @@ namespace rocpd
{ {
namespace data_storage namespace data_storage
{ {
static std::mutex _mutex;
class database class database
{ {
public: public:
@@ -182,8 +181,7 @@ public:
std::shared_ptr<sqlite3_stmt> stmt{ p_stmt, sqlite3_finalize }; std::shared_ptr<sqlite3_stmt> stmt{ p_stmt, sqlite3_finalize };
return [stmt, query, this](Values... value) { return [stmt, query, this](Values... value) {
std::lock_guard lock{ _mutex }; int position = 1;
int position = 1;
((bind_value(stmt.get(), position++, value, query)), ...); ((bind_value(stmt.get(), position++, value, query)), ...);