File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -502,4 +502,8 @@ class Config : public AbstractConfig {
502
502
503
503
constexpr char kUseDaemonEnvVar [] = " KINETO_USE_DAEMON" ;
504
504
505
+ #if __linux__
506
+ extern int kUseDaemonEnvVarSet ;
507
+ #endif
508
+
505
509
} // namespace libkineto
Original file line number Diff line number Diff line change 8
8
9
9
#include " Config.h"
10
10
11
+ #include < assert.h>
11
12
#include < stdlib.h>
12
13
13
14
#include < fmt/chrono.h>
@@ -243,7 +244,8 @@ Config::Config()
243
244
factories->addFeatureConfigs (*this );
244
245
}
245
246
#if __linux__
246
- enableIpcFabric_ = (getenv (kUseDaemonEnvVar ) != nullptr );
247
+ assert (libkineto::kUseDaemonEnvVarSet >= 0 );
248
+ enableIpcFabric_ = libkineto::kUseDaemonEnvVarSet ;
247
249
#endif
248
250
}
249
251
Original file line number Diff line number Diff line change 31
31
#include " Logger.h"
32
32
33
33
namespace KINETO_NAMESPACE {
34
+ #if __linux__
35
+ int kUseDaemonEnvVarSet = -1 ;
36
+ #endif
37
+
34
38
35
39
#if __linux__ || defined(HAS_CUPTI)
36
40
static bool initialized = false ;
@@ -131,7 +135,9 @@ void libkineto_init(bool cpuOnly, bool logOnError) {
131
135
132
136
// Factory to connect to open source daemon if present
133
137
#if __linux__
134
- if (getenv (kUseDaemonEnvVar ) != nullptr ) {
138
+ void *ptr = getenv (kUseDaemonEnvVar );
139
+ libkineto::kUseDaemonEnvVarSet = ptr != nullptr ;
140
+ if (libkineto::kUseDaemonEnvVarSet ) {
135
141
LOG (INFO) << " Registering daemon config loader, cpuOnly = "
136
142
<< cpuOnly;
137
143
DaemonConfigLoader::registerFactory ();
You can’t perform that action at this time.
0 commit comments