Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
213516c
link coolbpf libprofiler library
wokron Aug 9, 2025
2bc3e9e
add CpuProfiler
wokron Aug 9, 2025
4a90e69
eBPFDriver support cpu profiling
wokron Aug 9, 2025
c38f003
add ProcessScanner
wokron Aug 9, 2025
e3f36d5
PluginOptions alias
wokron Aug 9, 2025
fffe21d
add CpuProfilingManager
wokron Aug 9, 2025
45bb109
add InputCpuProfiling
wokron Aug 10, 2025
fddf0f9
handle invalid regex error
wokron Aug 10, 2025
d03172b
send profiling event to queue
wokron Aug 12, 2025
5c51899
misc updates
wokron Aug 18, 2025
815ceff
add ProcessDiscoveryManager
wokron Aug 18, 2025
bcd66af
cpu profiling support multi config
wokron Aug 19, 2025
c83ba79
remove old ProcessScanner
wokron Aug 19, 2025
8c5d574
use SetContentNoCopy
wokron Aug 19, 2025
8d336df
handle regex exception
wokron Aug 19, 2025
9823e94
remove unnecessary set to vector conversion
wokron Aug 19, 2025
7aec624
cpu profiling add metrics
wokron Aug 19, 2025
6185fa2
EBPFServerUnittest add cpu profiling
wokron Aug 19, 2025
0030333
add container discovery options
wokron Aug 19, 2025
8aa9645
update cmake in ebpf driver
wokron Aug 20, 2025
ce1bd6d
ListAllProcesses use ProcParser
wokron Aug 20, 2025
f227e25
process discovery support container id
wokron Aug 20, 2025
e0d057e
update container config in process discovery
wokron Aug 20, 2025
b2e7a3e
fix unused
wokron Aug 20, 2025
496f874
update eBPFDriver
wokron Aug 25, 2025
45700b8
support libprofiler set_host_root_path
wokron Sep 16, 2025
102e24f
fix parseStackCnt
wokron Sep 16, 2025
2dae7b2
cpu profiling event set timestamp
wokron Sep 16, 2025
ec0cb9c
update config parse logic
wokron Sep 16, 2025
86c3fb8
add CpuProfilingManagerUnittest
wokron Sep 16, 2025
130e661
refactor AddOrUpdateDiscovery
wokron Sep 16, 2025
b2139f9
fix build failure
wokron Sep 17, 2025
040210d
support trace_id
wokron Oct 20, 2025
a1ad9c2
add livetrace_enable_tracing
wokron Oct 20, 2025
969ea9d
update coolbpf commit
wokron Nov 6, 2025
7f7d531
update build deps
wokron Nov 6, 2025
55ea258
fix build
wokron Nov 6, 2025
30970ad
disable container match
wokron Nov 7, 2025
b1b5b93
format code
wokron Nov 7, 2025
fc71c07
ContainerManager add handler
wokron Nov 11, 2025
8d0e8cd
cpu profiling resupport container discovery
wokron Nov 11, 2025
8ba1255
fix
wokron Nov 13, 2025
ca232c9
remove unused code
wokron Nov 13, 2025
89839c4
use arms format
wokron Nov 14, 2025
f330544
fix
wokron Nov 14, 2025
42bf65a
remove hard code
wokron Nov 26, 2025
7913280
custom app name
wokron Nov 26, 2025
036fc64
add language config
wokron Nov 27, 2025
9c8a38e
replace hard code key
wokron Nov 27, 2025
ba6baa4
use NoCopy
wokron Nov 27, 2025
e6cd0ac
fix name
wokron Nov 27, 2025
7528b1d
format code
wokron Nov 28, 2025
c8de186
support collect interval
wokron Dec 10, 2025
399e504
support build libprofiler
wokron Dec 18, 2025
4ce4e51
try fix build
wokron Dec 18, 2025
64db983
styles update
wokron Feb 27, 2026
9e1e38c
use raw string
wokron Feb 27, 2026
f87ea04
use BoostRegexMatch
wokron Feb 27, 2026
3432235
remove retry logic
wokron Feb 27, 2026
dbfa24a
remove some assert
wokron Feb 27, 2026
7ffda56
minor update
wokron Feb 27, 2026
32d04fe
use StringTo
wokron Feb 27, 2026
cf99291
remove assert
wokron Mar 1, 2026
fd5a882
move CpuProfiler impl to source file
wokron Mar 1, 2026
42e627a
UpdateDiscovery just pass ContainerDiff
wokron Mar 1, 2026
bb6b550
remove old UpdateDiscovery
wokron Mar 1, 2026
2abe71a
move ContainerManager callback place
wokron Mar 1, 2026
df3e33a
refactor ContainerManager callback logic
wokron Mar 1, 2026
90e2cd0
check regex in config init
wokron Mar 1, 2026
7ffdbb7
fix build
wokron Mar 2, 2026
1ffef40
update option init test
wokron Mar 2, 2026
8191f24
add missing format
wokron Mar 3, 2026
f867fad
update todo comment
wokron Mar 4, 2026
ad368a1
update ProcessDiscoveryManager sleep interval
wokron Mar 4, 2026
888bdf6
valNs use uint64
wokron Mar 4, 2026
b34daed
remove mContainerHandlersMutex
wokron Mar 4, 2026
48da876
clean up apply diff logic
wokron Mar 4, 2026
c172191
refactor profiling collect interval
wokron Mar 4, 2026
4b2d826
parseStackCnt and addContentToEvent become static method
wokron Mar 4, 2026
7f5301c
unittest use shorter discovery interval
wokron Mar 4, 2026
ed1fb8a
check stack empty
wokron Mar 4, 2026
ced4e64
reserve size in addContentToEvent
wokron Mar 4, 2026
631e70e
extract FindAllMatch method
wokron Mar 4, 2026
8408ccc
add process match cache
wokron Mar 4, 2026
d4d420e
add test for addContentToEvent
wokron Mar 4, 2026
b540ae3
update parseStackCnt
wokron Mar 4, 2026
cf4e7c3
parseStackCnt unittest
wokron Mar 4, 2026
fa80ee9
add missing format
wokron Mar 5, 2026
17fe8ef
add docs
wokron Mar 5, 2026
1e280e4
reserve space for jsonLabels
wokron Mar 5, 2026
3abcf77
also poll when pid is empty
wokron May 13, 2026
0d955f1
better parseStackCnt
wokron May 13, 2026
a78b301
use Json::Value
wokron May 13, 2026
b2dcbf7
remove GetContainerHostPath
wokron May 13, 2026
18352a2
add ContainerManager ut
wokron May 13, 2026
f006915
optim process discovery cache
wokron May 13, 2026
9f1231f
remove uesless ListAllProcesses
wokron May 13, 2026
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
2 changes: 1 addition & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ if (LINUX)
if (ENABLE_ENTERPRISE)
set(SUB_DIRECTORIES_LIST ${SUB_DIRECTORIES_LIST} shennong shennong/sdk apm/forward)
endif()
set(SUB_DIRECTORIES_LIST ${SUB_DIRECTORIES_LIST} ebpf ebpf/type ebpf/type/table ebpf/util ebpf/util/sampler ebpf/protocol/http ebpf/protocol/mysql ebpf/protocol ebpf/plugin/file_security ebpf/plugin/network_observer ebpf/plugin/process_security ebpf/plugin/network_security ebpf/plugin ebpf/observer ebpf/security
set(SUB_DIRECTORIES_LIST ${SUB_DIRECTORIES_LIST} ebpf ebpf/type ebpf/type/table ebpf/util ebpf/util/sampler ebpf/protocol/http ebpf/protocol/mysql ebpf/protocol ebpf/plugin/file_security ebpf/plugin/network_observer ebpf/plugin/process_security ebpf/plugin/network_security ebpf/plugin/cpu_profiling ebpf/plugin ebpf/observer ebpf/security
prometheus prometheus/labels prometheus/schedulers prometheus/async prometheus/component
host_monitor host_monitor/collector host_monitor/common forward forward/loongsuite
)
Expand Down
2 changes: 1 addition & 1 deletion core/_thirdparty/coolbpf
Submodule coolbpf updated from bc2e5e to 111b2f
1 change: 1 addition & 0 deletions core/app_config/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ class AppConfig {
friend class PollingPreservedDirDepthUnittest;
friend class InputStaticFileUnittest;
friend class LogInputReaderUnittest;
friend class eBPFServerUnittest;
#endif
};

Expand Down
5 changes: 5 additions & 0 deletions core/collection_pipeline/plugin/PluginRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#include "plugin/flusher/kafka/FlusherKafka.h"
#endif
#if defined(__linux__) && !defined(__ANDROID__)
#include "plugin/input/InputCpuProfiling.h"
#include "plugin/input/InputFileSecurity.h"
#include "plugin/input/InputHostMeta.h"
#include "plugin/input/InputHostMonitor.h"
Expand All @@ -78,6 +79,7 @@ DEFINE_FLAG_BOOL(enable_ebpf_network_observer, "", true);
DEFINE_FLAG_BOOL(enable_ebpf_process_secure, "", true);
DEFINE_FLAG_BOOL(enable_ebpf_file_secure, "", true);
DEFINE_FLAG_BOOL(enable_ebpf_network_secure, "", false);
DEFINE_FLAG_BOOL(enable_ebpf_cpu_profiling, "", false);

using namespace std;

Expand Down Expand Up @@ -174,6 +176,9 @@ void PluginRegistry::LoadStaticPlugins() {
if (BOOL_FLAG(enable_ebpf_network_secure)) {
RegisterContinuousInputCreator(new StaticInputCreator<InputNetworkSecurity>(), true);
}
if (BOOL_FLAG(enable_ebpf_cpu_profiling)) {
RegisterContinuousInputCreator(new StaticInputCreator<InputCpuProfiling>(), false);
}
RegisterContinuousInputCreator(new StaticInputCreator<InputHostMeta>(), true);
RegisterContinuousInputCreator(new StaticInputCreator<InputHostMonitor>(), true);
RegisterContinuousInputCreator(new StaticInputCreator<InputForward>());
Expand Down
39 changes: 35 additions & 4 deletions core/container_manager/ContainerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,23 @@ void ContainerManager::ApplyContainerDiffs() {
auto nameConfigMap = FileServer::GetInstance()->GetAllFileDiscoveryConfigs();
std::vector<std::shared_ptr<MatchedContainerInfo>> configResults;
for (auto& pair : mConfigContainerDiffMap) {
const auto& itr = nameConfigMap.find(pair.first);
if (itr == nameConfigMap.end()) {
FileDiscoveryOptions* options = nullptr;
const CollectionPipelineContext* ctx = nullptr;
if (const auto itr = nameConfigMap.find(pair.first); itr != nameConfigMap.end()) {
options = itr->second.first;
ctx = itr->second.second;
} else if (const auto handlerItr = mContainerHandlers.find(pair.first);
handlerItr != mContainerHandlers.end()) {
auto* options = handlerItr->second.first.first;
if (options->IsContainerDiscoveryEnabled()) {
auto& callback = handlerItr->second.second;
// Invoke callback
callback(pair.second);
}
continue;
} else {
continue;
}
const auto& options = itr->second.first;
const auto& ctx = itr->second.second;

const auto& diff = pair.second;

Expand Down Expand Up @@ -206,6 +217,17 @@ bool ContainerManager::CheckContainerDiffForAllConfig() {
}
}
}
{
for (auto itr = mContainerHandlers.begin(); itr != mContainerHandlers.end(); ++itr) {
FileDiscoveryOptions* options = itr->second.first.first;
if (options->IsContainerDiscoveryEnabled()) {
bool isCurrentConfigUpdate = checkContainerDiffForOneConfig(options, itr->second.first.second);
if (isCurrentConfigUpdate) {
isUpdate = true;
}
}
}
}
return isUpdate;
}

Expand Down Expand Up @@ -270,6 +292,15 @@ void ContainerManager::sendMatchedContainerInfo(std::vector<std::shared_ptr<Matc
}
}

void ContainerManager::AddContainerHandler(const std::string& name,
const FileDiscoveryConfig& config,
const std::function<void(std::shared_ptr<ContainerDiff>)>& handler) {
mContainerHandlers[name] = std::make_pair(config, handler);
}

void ContainerManager::RemoveContainerHandler(const std::string& name) {
mContainerHandlers.erase(name);
}

bool ContainerManager::checkContainerDiffForOneConfig(FileDiscoveryOptions* options,
const CollectionPipelineContext* ctx) {
Expand Down
8 changes: 8 additions & 0 deletions core/container_manager/ContainerManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ class ContainerManager {
void UpdateMatchedContainerInfoPipeline(CollectionPipelineContext* ctx, size_t inputIndex);
void RemoveMatchedContainerInfoPipeline();

void AddContainerHandler(const std::string& name,
Comment thread
wokron marked this conversation as resolved.
const FileDiscoveryConfig& config,
const std::function<void(std::shared_ptr<ContainerDiff>)>& handler);
void RemoveContainerHandler(const std::string& name);
Comment thread
wokron marked this conversation as resolved.

private:
void pollingLoop();
void refreshAllContainersSnapshot();
Expand Down Expand Up @@ -101,6 +106,9 @@ class ContainerManager {
mutable ReadWriteLock mMatchedContainerInfoPipelineMux;
CollectionPipelineContext* mMatchedContainerInfoPipelineCtx = nullptr;
size_t mMatchedContainerInfoInputIndex = 0;

using ContainerHandler = std::pair<FileDiscoveryConfig, std::function<void(std::shared_ptr<ContainerDiff>)>>;
std::unordered_map<std::string, ContainerHandler> mContainerHandlers;
};

} // namespace logtail
76 changes: 76 additions & 0 deletions core/ebpf/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <string>
#include <unordered_set>

#include "app_config/AppConfig.h"
#include "common/Flags.h"
#include "common/ParamExtractor.h"
#include "logger/Logger.h"
Expand Down Expand Up @@ -555,6 +556,81 @@ bool SecurityOptions::Init(SecurityProbeType probeType,
return true;
}

bool CpuProfilingOption::Init(const Json::Value& config,
const CollectionPipelineContext* mContext,
const std::string& sName) {
std::string errorMsg;

if (!GetOptionalUIntParam(config, "CollectIntervalMs", mCollectIntervalMs, errorMsg)) {
PARAM_WARNING_IGNORE(mContext->GetLogger(),
mContext->GetAlarm(),
errorMsg,
sName,
mContext->GetConfigName(),
mContext->GetProjectName(),
mContext->GetLogstoreName(),
mContext->GetRegion());
}

if (!GetOptionalStringParam(config, "AppName", mAppName, errorMsg)) {
PARAM_WARNING_IGNORE(mContext->GetLogger(),
mContext->GetAlarm(),
errorMsg,
sName,
mContext->GetConfigName(),
mContext->GetProjectName(),
mContext->GetLogstoreName(),
mContext->GetRegion());
}

if (!GetOptionalStringParam(config, "Language", mLanguage, errorMsg)) {
PARAM_WARNING_IGNORE(mContext->GetLogger(),
mContext->GetAlarm(),
errorMsg,
sName,
mContext->GetConfigName(),
mContext->GetProjectName(),
mContext->GetLogstoreName(),
mContext->GetRegion());
}

std::vector<std::string> cmdlineStrs;
if (!GetOptionalListFilterParam<std::string>(config, "CommandLines", cmdlineStrs, errorMsg)) {
PARAM_WARNING_IGNORE(mContext->GetLogger(),
mContext->GetAlarm(),
errorMsg,
sName,
mContext->GetConfigName(),
mContext->GetProjectName(),
mContext->GetLogstoreName(),
mContext->GetRegion());
return false;
}
for (const auto& cmdlineStr : cmdlineStrs) {
try {
mCmdlines.emplace_back(cmdlineStr);
} catch (const boost::regex_error& e) {
PARAM_WARNING_IGNORE(mContext->GetLogger(),
mContext->GetAlarm(),
"Invalid command line regex: " + cmdlineStr + ", error: " + e.what(),
sName,
mContext->GetConfigName(),
mContext->GetProjectName(),
mContext->GetLogstoreName(),
mContext->GetRegion());
return false;
}
}

if (AppConfig::GetInstance()->IsPurageContainerMode()) {
if (!mContainerDiscovery.Init(config, *mContext, sName)) {
return false;
}
}

return true;
}

//////
void eBPFAdminConfig::LoadEbpfConfig(const Json::Value& confJson) {
// receive_event_chan_cap (Optional)
Expand Down
18 changes: 18 additions & 0 deletions core/ebpf/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "json/json.h"

#include "collection_pipeline/CollectionPipelineContext.h"
#include "container_manager/ContainerDiscoveryOptions.h"
#include "ebpf/include/export.h"

namespace logtail::ebpf {
Expand Down Expand Up @@ -48,6 +49,23 @@ class SecurityOptions {
SecurityProbeType mProbeType;
};

///////////////////// /////////////////////

class CpuProfilingOption {
public:
bool Init(const Json::Value& config, const CollectionPipelineContext* mContext, const std::string& sName);

uint32_t mCollectIntervalMs = 0; // 0 means use default
std::vector<boost::regex> mCmdlines;
std::string mAppName;
// Since ebpf may collect mulit-language profiling data,
// the language field should be set by user.
std::string mLanguage = "java";
ContainerDiscoveryOptions mContainerDiscovery;
};

using PluginOptions = std::variant<SecurityOptions*, ObserverNetworkOption*, CpuProfilingOption*>;

///////////////////// Process Level Config /////////////////////

struct AdminConfig {
Expand Down
43 changes: 30 additions & 13 deletions core/ebpf/EBPFServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "ebpf/plugin/AbstractManager.h"
#include "logger/Logger.h"
#include "monitor/metric_models/ReentrantMetricsRecord.h"
#include "plugin/cpu_profiling/CpuProfilingManager.h"
#include "plugin/file_security/FileSecurityManager.h"
#include "plugin/network_observer/NetworkObserverManager.h"
#include "plugin/network_security/NetworkSecurityManager.h"
Expand Down Expand Up @@ -59,7 +60,8 @@ bool EnvManager::IsSupportedEnv(PluginType type) {
break;
case PluginType::FILE_SECURITY:
case PluginType::NETWORK_SECURITY:
case PluginType::PROCESS_SECURITY: {
case PluginType::PROCESS_SECURITY:
case PluginType::CPU_PROFILING: {
status = mArchSupport && mBTFSupport;
break;
}
Expand Down Expand Up @@ -282,10 +284,10 @@ bool EBPFServer::startPluginInternal(const std::string& pipelineName,
uint32_t pluginIndex,
PluginType type,
const logtail::CollectionPipelineContext* ctx,
const std::variant<SecurityOptions*, ObserverNetworkOption*>& options,
const PluginOptions& options,
const PluginMetricManagerPtr& metricManager) {
bool isNeedProcessCache = false;
if (type != PluginType::NETWORK_OBSERVE) {
if (type != PluginType::NETWORK_OBSERVE && type != PluginType::CPU_PROFILING) {
isNeedProcessCache = true;
}
auto& pluginMgr = getPluginState(type).mManager;
Expand Down Expand Up @@ -346,6 +348,17 @@ bool EBPFServer::startPluginInternal(const std::string& pipelineName,
}
break;
}

case PluginType::CPU_PROFILING: {
if (!pluginMgr) {
auto mgr = CpuProfilingManager::Create(
mProcessCacheManager, mEBPFAdapter, mCommonEventQueue, &mEventPool, mHostPathPrefix.string());
mgr->SetMetrics(mRecvKernelEventsTotal);
pluginMgr = mgr;
}
break;
}

default:
LOG_ERROR(sLogger, ("Unknown plugin type", int(type)));
return false;
Expand All @@ -371,7 +384,8 @@ bool EBPFServer::startPluginInternal(const std::string& pipelineName,
}

updatePluginState(type, pipelineName, ctx->GetProjectName(), PluginStateOperation::kAddPipeline, pluginMgr);
if (type != PluginType::PROCESS_SECURITY && type != PluginType::NETWORK_OBSERVE) {
if (type != PluginType::PROCESS_SECURITY && type != PluginType::NETWORK_OBSERVE
&& type != PluginType::CPU_PROFILING) {
RegisterPluginPerfBuffers(type);
}

Expand All @@ -391,7 +405,7 @@ bool EBPFServer::EnablePlugin(const std::string& pipelineName,
uint32_t pluginIndex,
PluginType type,
const CollectionPipelineContext* ctx,
const std::variant<SecurityOptions*, ObserverNetworkOption*>& options,
const PluginOptions& options,
const PluginMetricManagerPtr& mgr) {
if (!IsSupportedEnv(type)) {
return false;
Expand Down Expand Up @@ -550,14 +564,17 @@ void EBPFServer::pollPerfBuffers() {
mProcessCacheManager->ClearProcessExpiredCache();

// TODO (@qianlu.kk) adapt to ConsumePerfBufferData
auto& pluginState = getPluginState(PluginType::NETWORK_OBSERVE);
if (!pluginState.mValid.load(std::memory_order_acquire)) {
continue;
}
std::shared_lock<std::shared_mutex> lock(pluginState.mMtx);
if (pluginState.mManager) {
auto* mgr = static_cast<NetworkObserverManager*>(pluginState.mManager.get());
mgr->PollPerfBuffer(0); // 0 means non-blocking r(ef: https://libbpf.readthedocs.io/en/latest/api.html)
std::vector<PluginState*> pluginStatePtrs
= {&getPluginState(PluginType::NETWORK_OBSERVE), &getPluginState(PluginType::CPU_PROFILING)};
for (auto& pluginStatePtr : pluginStatePtrs) {
auto& pluginState = *pluginStatePtr;
if (!pluginState.mValid.load(std::memory_order_acquire)) {
continue;
}
std::shared_lock<std::shared_mutex> lock(pluginState.mMtx);
if (pluginState.mManager) {
pluginState.mManager->PollPerfBuffer(0); // 0 means non-blocking
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions core/ebpf/EBPFServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class EBPFServer : public InputRunner {
uint32_t pluginIndex,
PluginType type,
const logtail::CollectionPipelineContext* ctx,
const std::variant<SecurityOptions*, ObserverNetworkOption*>& options,
const PluginOptions& options,
const PluginMetricManagerPtr& mgr);

bool DisablePlugin(const std::string& pipelineName, PluginType type);
Expand All @@ -118,7 +118,7 @@ class EBPFServer : public InputRunner {
uint32_t pluginIndex,
PluginType type,
const logtail::CollectionPipelineContext* ctx,
const std::variant<SecurityOptions*, ObserverNetworkOption*>& options,
const PluginOptions& options,
const PluginMetricManagerPtr& metricManager);
EBPFServer();

Expand Down
15 changes: 13 additions & 2 deletions core/ebpf/driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,21 @@ if (LINUX)
# Restore the original C flags for the rest of the build
set(CMAKE_C_FLAGS ${ORIGINAL_CMAKE_C_FLAGS})

add_custom_target(
build_libprofiler ALL
COMMAND CARGO_TARGET_DIR=${CMAKE_BINARY_DIR}/_thirdparty/coolbpf/src/profiler cargo build -r
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/_thirdparty/coolbpf/src/profiler
)
add_library(profiler SHARED IMPORTED)
set_target_properties(profiler PROPERTIES
IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/_thirdparty/coolbpf/src/profiler/release/libprofiler.so
IMPORTED_NO_SONAME TRUE
)
add_dependencies(profiler build_libprofiler)
add_custom_target(
install_coolbpf ALL
COMMAND ${CMAKE_COMMAND} --install ${CMAKE_BINARY_DIR}/_thirdparty/coolbpf
DEPENDS coolbpf coolbpf_static
DEPENDS coolbpf coolbpf_static build_libprofiler
)

include_directories("${DEPS_INCLUDE_ROOT}/coolbpf")
Expand All @@ -49,7 +60,7 @@ if (LINUX)

add_library(${EBPF_DIRVER_TARGET} SHARED ${LIB_SOURCE_FILES})
target_link_options(${EBPF_DIRVER_TARGET} PRIVATE "-Wl,-rpath=.:${DEFAULT_DEPS_ROOT}/lib")
target_link_libraries(${EBPF_DIRVER_TARGET} coolbpf)
target_link_libraries(${EBPF_DIRVER_TARGET} coolbpf profiler)
add_dependencies(${EBPF_DIRVER_TARGET} install_coolbpf)
target_compile_options(${EBPF_DIRVER_TARGET} PRIVATE -fPIC)
endif ()
Loading