Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

cmake_minimum_required(VERSION 3.20 FATAL_ERROR)

project(CommoneLowLevelTracingKit LANGUAGES C CXX)
project(CommonLowLevelTracingKit LANGUAGES C CXX)

include(cmake/Toolchain.cmake)
include(cmake/ToolchainVersionCheck.cmake)
Expand All @@ -16,10 +16,10 @@ include(cmake/ASAN.cmake)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
# We're in the root, define additional targets for developers.
message(STATUS "clltk is standalone")
option(STANDALONE_PROJECT "" "ON")
option(STANDALONE_PROJECT "Build as standalone project" ON)
else()
message(STATUS "clltk is imported")
option(STANDALONE_PROJECT "" "OFF")
option(STANDALONE_PROJECT "Build as standalone project" OFF)
endif()

set(CLLTK_TRACING_LIB_TYPE "STATIC" CACHE STRING "make target clltk_tracing alias for clltk_tracing_shared with \"SHARED\" or clltk_tracing_static with \"STATIC\"")
Expand Down Expand Up @@ -47,7 +47,7 @@ if(CLLTK_COMMAND_LINE_TOOL)
endif()

option(CLLTK_PYTHON_DECODER "select python decoder for packaging" ON)
option(CLLTK_CPP_DECODER "select python decoder for packaging" ON)
option(CLLTK_CPP_DECODER "select cpp decoder for packaging" ON)
add_subdirectory(./decoder_tool)

option(CLLTK_KERNEL_TRACING "select kernel tracing module for build" ${STANDALONE_PROJECT})
Expand Down
24 changes: 4 additions & 20 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_INTERPROCEDURAL_OPTIMIZATION": "ON",
"CMAKE_POSITION_INDEPENDENT_CODE": "ON",
"CMAKE_CXX_FLAGS_DEBUG": " -Og -g ",
"CMAKE_C_FLAGS_DEBUG": " -Og -g ",
"STANDALONE_PROJECT": "ON"
}
},
Expand All @@ -23,19 +27,6 @@
"CLLTK_EXAMPLES": "ON"
}
},
{
"name": "release",
"inherits": "default",
"displayName": "Release",
"description": "Optimized release build with LTO.",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_CXX_FLAGS_RELEASE": "-O3 -flto -DNDEBUG",
"CMAKE_C_FLAGS_RELEASE": "-O3 -flto -DNDEBUG",
"CMAKE_INTERPROCEDURAL_OPTIMIZATION": "TRUE",
"CLLTK_TESTS": "OFF"
}
},
{
"name": "rpm",
"inherits": "default",
Expand Down Expand Up @@ -71,13 +62,6 @@
"targets": [
"all"
]
},
{
"name": "release",
"configurePreset": "release",
"targets": [
"all"
]
}
],
"testPresets": [
Expand Down
14 changes: 12 additions & 2 deletions VERSION.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
1.2.47
1.2.48

# Change log
## 1.2.47+
## 1.2.48
refactor: reorganize include structure and improve project layout
- Renamed project from CommoneLowLevelTracingKit to CommonLowLevelTracingKit (correcting typo).
- Reorganized header paths under CommonLowLevelTracingKit/tracing/, CommonLowLevelTracingKit/decoder/, and CommonLowLevelTracingKit/snapshot/ for better namespace clarity.
- Updated all #include directives to use the new consistent path structure (e.g., tracing.h → tracing/tracing.h).
- Updated CMake targets to use OUTPUT_NAME consistently and improved library linking with proper visibility and standard settings.
- Restructured decoder_tool and snapshot_library to use consistent directory layout and public headers.
- Fixed include paths in all examples, tests, and kernel module code to reflect new structure.
- Removed redundant CMake logic and improved target properties.
- Enable optimization
## 1.2.47
- fix macros
- add more cmake options
## 1.2.46
Expand Down
2 changes: 1 addition & 1 deletion clltk.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
"type": "lldb",
"request": "launch",
"cwd": "${workspaceFolder}",
"program": "${command:cmake.buildDirectory}/command_line_tool/clltk",
"program": "${workspaceFolder}/build/command_line_tool/clltk",
"sourceLanguages": [
"c",
"c++"
Expand Down
31 changes: 24 additions & 7 deletions cmake/CreatePackage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,34 @@

include(GNUInstallDirs)

set(CPACK_PACKAGE_NAME "CommonLowLevelTracingKit")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CommonLowLevelTracingKit - common low level tracing kit")
set(CPACK_PACKAGE_DESCRIPTION "a fast, lightweight, binary, always-on, printf-style, file-based and flight-recorder-like tracing library")
# Main package configuration
set(CPACK_PACKAGE_NAME "clltk")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Common Low Level Tracing Kit - High-performance binary tracing library")
set(CPACK_PACKAGE_DESCRIPTION "A fast, lightweight, binary, always-on, printf-style, file-based and flight-recorder-like tracing library for C/C++ applications. Provides low-overhead tracing with binary format support, kernel-space tracing capabilities, and comprehensive debugging tools.")
set(CPACK_PACKAGE_VERSION_MAJOR ${CLLTK_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${CLLTK_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${CLLTK_VERSION_PATCH})
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/IBM/CommonLowLevelTracingKit")
set(CPACK_PACKAGE_VENDOR "IBM by Eduard Stefes <Eduard.Stefes@ibm.com> - Johannes Staib <Johannes.Staib@ibm.com>")
set(CPACK_PACKAGE_CHECKSUM MD5)
set(CPACK_PACKAGE_VENDOR "IBM")
set(CPACK_PACKAGE_CONTACT "Eduard Stefes <Eduard.Stefes@ibm.com>, Johannes Staib <Johannes.Staib@ibm.com>")
set(CPACK_PACKAGE_CHECKSUM SHA256)

# Component descriptions
set(CPACK_COMPONENT_TRACING_DISPLAY_NAME "CLLTK Runtime Libraries")
set(CPACK_COMPONENT_TRACING_DESCRIPTION "Core tracing runtime libraries (shared and static)")
set(CPACK_COMPONENT_TRACING_GROUP "Runtime")

set(CPACK_COMPONENT_CMD_DISPLAY_NAME "CLLTK Command Line Tools")
set(CPACK_COMPONENT_CMD_DESCRIPTION "Command line utilities for trace management")
set(CPACK_COMPONENT_CMD_GROUP "Tools")

set(CPACK_COMPONENT_SNAPSHOT_DISPLAY_NAME "CLLTK Snapshot Library")
set(CPACK_COMPONENT_SNAPSHOT_DESCRIPTION "Libraries for snapshot and archival functionality")
set(CPACK_COMPONENT_SNAPSHOT_GROUP "Runtime")

set(CPACK_COMPONENT_DECODER_DISPLAY_NAME "CLLTK Decoder Libraries")
set(CPACK_COMPONENT_DECODER_DESCRIPTION "Trace decoding and analysis libraries")
set(CPACK_COMPONENT_DECODER_GROUP "Runtime")

set(CPACK_SOURCE_IGNORE_FILES
"${CMAKE_BINARY_DIR}"
Expand All @@ -23,11 +42,9 @@ set(CPACK_SOURCE_IGNORE_FILES
)

set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
set(CPACK_RPM_snapshot_PACKAGE_REQUIRES "tar >= 0.0.0, z >= 1.3")
set(CPACK_RPM_PACKAGE_RELEASE 1)
set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX "/clltk-debug")
set(CPACK_RPM_PACKAGE_LICENSE "BSD-2-Clause-Patent")
set(CPACK_OUTPUT_FILE_PREFIX "${CMAKE_BINARY_DIR}/packages")


include(CPack)
43 changes: 28 additions & 15 deletions command_line_tool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,36 @@ foreach(COMMAND_FOLDER IN LISTS COMMAND_FOLDERS)
endforeach()


# Check that all commands are OBJECT or SHARED libraries
foreach(command_target ${CLLTK_COMMAND_LINE_COMMANDS})
get_target_property(target_type ${command_target} TYPE)
if( "${command_target}" STREQUAL "OBJECT_LIBRARY" OR "${command_target}" STREQUAL "SHARED_LIBRARY")
message(FATAL_ERROR "To ensure that commands in the main function are detected at runtime, ${command_target} must be OBJECT or SHARED library, not ${target_type}.")
endif()
endforeach()

# create the clltk executable
add_executable(clltk-cmd
main/main.cpp
main/validators.cpp
)

target_link_libraries(clltk-cmd
clltk-cmd-interface
clltk-version
${CLLTK_COMMAND_LINE_COMMANDS}
PRIVATE
clltk-cmd-interface
clltk-version
)

# Check that all commands are OBJECT or SHARED libraries
foreach(command_target ${CLLTK_COMMAND_LINE_COMMANDS})
get_target_property(target_type ${command_target} TYPE)
if( "${command_target}" STREQUAL "OBJECT_LIBRARY")
message(FATAL_ERROR "To ensure that commands in the main function are detected at runtime, ${command_target} must be OBJECT library, not ${target_type}.")
endif()
target_sources(clltk-cmd
PRIVATE
$<TARGET_OBJECTS:${command_target}>
)

target_link_libraries(clltk-cmd
PRIVATE
${command_target}
)
endforeach()


set_target_properties(clltk-cmd PROPERTIES
OUTPUT_NAME clltk
INTERPROCEDURAL_OPTIMIZATION TRUE
Expand All @@ -51,8 +61,11 @@ target_compile_options(clltk-cmd
PRIVATE
-Os
)

install(TARGETS clltk-cmd
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT cmd
install(TARGETS
clltk-cmd
${CLLTK_COMMAND_LINE_COMMANDS}
EXPORT CLLTKTracingTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT cmd
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT cmd
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT cmd
)
10 changes: 4 additions & 6 deletions command_line_tool/commands/decode/decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include <functional>
#include <string>

#include "CommonLowLevelTracingKit/Decoder/Tracebuffer.hpp"
#include "CommonLowLevelTracingKit/interface.hpp"
#include "CommonLowLevelTracingKit/decoder/Tracebuffer.hpp"
#include "commands/interface.hpp"

using namespace std::string_literals;

Expand Down Expand Up @@ -128,11 +128,9 @@ static void add_decode_command(CLI::App &app)
});
}

static int init_function() noexcept
static void init_function() noexcept
{
auto [app, lock] = CommonLowLevelTracingKit::cmd::interface::acquireMainApp();
add_decode_command(app);
return 0;
}

static const int dummy = init_function();
COMMAND_INIT(init_function);
12 changes: 5 additions & 7 deletions command_line_tool/commands/snapshot/snapshot.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) 2024, International Business Machines
// SPDX-License-Identifier: BSD-2-Clause-Patent

#include "CommonLowLevelTracingKit/snapshot.hpp"
#include "CommonLowLevelTracingKit/interface.hpp"
#include "CommonLowLevelTracingKit/snapshot/snapshot.hpp"
#include "commands/interface.hpp"
#include <iostream>
#include <optional>
#include <stdexcept>
Expand Down Expand Up @@ -52,7 +52,7 @@ static void add_snapshot_command(CLI::App &app)
static CommonLowLevelTracingKit::snapshot::verbose_function_t verbose{};
command->add_flag_callback("--verbose,-v", [&]() { verbose = verbose_func; });

static std::string output_file_name{"traces.snapshot_library"};
static std::string output_file_name{"snapshot.clltk"};
command->add_option("--output,-f", output_file_name, "")->capture_default_str();

static std::vector<std::string> tracepoints;
Expand All @@ -65,11 +65,9 @@ static void add_snapshot_command(CLI::App &app)
[&]() { take_snapshot(output_file_name, tracepoints, compress, bucket_size, verbose); });
}

static int init_function() noexcept
static void init_function() noexcept
{
auto [app, lock] = CommonLowLevelTracingKit::cmd::interface::acquireMainApp();
add_snapshot_command(app);
return 0;
}

static const int dummy = init_function();
COMMAND_INIT(init_function);
10 changes: 4 additions & 6 deletions command_line_tool/commands/trace/tracebuffer.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) 2024, International Business Machines
// SPDX-License-Identifier: BSD-2-Clause-Patent

#include "CommonLowLevelTracingKit/interface.hpp"
#include "CommonLowLevelTracingKit/tracing.h"
#include "CommonLowLevelTracingKit/tracing/tracing.h"
#include "commands/interface.hpp"
#include <stddef.h>
#include <string>

Expand Down Expand Up @@ -41,11 +41,9 @@ static void add_create_tracebuffer_command(CLI::App &app)
command->callback([]() { clltk_dynamic_tracebuffer_creation(tracebuffer.c_str(), size); });
}

static int init_function() noexcept
static void init_function() noexcept
{
auto [app, lock] = CommonLowLevelTracingKit::cmd::interface::acquireMainApp();
add_create_tracebuffer_command(app);
return 0;
}

static const int dummy = init_function();
COMMAND_INIT(init_function);
10 changes: 4 additions & 6 deletions command_line_tool/commands/trace/tracepipe.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) 2024, International Business Machines
// SPDX-License-Identifier: BSD-2-Clause-Patent

#include "CommonLowLevelTracingKit/interface.hpp"
#include "CommonLowLevelTracingKit/tracing.h"
#include "CommonLowLevelTracingKit/tracing/tracing.h"
#include "commands/interface.hpp"
#include <functional>
#include <initializer_list>
#include <iostream>
Expand Down Expand Up @@ -122,11 +122,9 @@ class Command
}
};

static int init_function() noexcept
static void init_function() noexcept
{
auto [app, lock] = CommonLowLevelTracingKit::cmd::interface::acquireMainApp();
Command::AddCommand(app);
return 0;
}

static const int dummy = init_function();
COMMAND_INIT(init_function);
10 changes: 4 additions & 6 deletions command_line_tool/commands/trace/tracepoint.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) 2024, International Business Machines
// SPDX-License-Identifier: BSD-2-Clause-Patent

#include "CommonLowLevelTracingKit/interface.hpp"
#include "CommonLowLevelTracingKit/tracing.h"
#include "CommonLowLevelTracingKit/tracing/tracing.h"
#include "commands/interface.hpp"
#include <cstdint>
#include <stddef.h>
#include <string>
Expand Down Expand Up @@ -69,11 +69,9 @@ static void add_create_tracepoint_command(CLI::App &app)
});
}

static int init_function() noexcept
static void init_function() noexcept
{
auto [app, lock] = CommonLowLevelTracingKit::cmd::interface::acquireMainApp();
add_create_tracepoint_command(app);
return 0;
}

static const int dummy = init_function();
COMMAND_INIT(init_function);
2 changes: 1 addition & 1 deletion command_line_tool/interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ add_library(clltk-cmd-interface INTERFACE)

target_include_directories(clltk-cmd-interface
INTERFACE
./include/
.
)

target_link_libraries(clltk-cmd-interface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,18 @@
#include "CLI/Config.hpp" // IWYU pragma: export
#include "CLI/Formatter.hpp" // IWYU pragma: export
#include "CLI/Validators.hpp" // IWYU pragma: export
#include <CLI/Error.hpp> // IWYU pragma: export
#include <CLI/Option.hpp> // IWYU pragma: export
#if __has_include("CLI/ExtraValidators.hpp")
#include "CLI/ExtraValidators.hpp" // IWYU pragma: export
#endif
#include <CLI/Error.hpp> // IWYU pragma: export
#include <CLI/Option.hpp> // IWYU pragma: export

#include <mutex>

typedef void (*init_fn)(void);
#define COMMAND_INIT(func) \
__attribute__((retain, used, section("clltk_cmdinit"))) static init_fn _init_##func##_ptr = func

namespace CommonLowLevelTracingKit::cmd::interface
{
using MainAppHandle = std::pair<CLI::App &, std::unique_lock<std::mutex>>;
Expand Down
Loading