@@ -36,8 +36,8 @@ int main(int argc, char *argv[]) {
3636 cxxopts::value<std::string>()->default_value (" ./microbench/malloc" ))(
3737 " h,help" , " Help for CXLMemSim" , cxxopts::value<bool >()->default_value (" false" ))(
3838 " c,cpuset" , " The CPUSET for CPU to set affinity on and only run the target process on those CPUs" ,
39- cxxopts::value<std::vector<int >>()->default_value (" 0,1,2,3" ))(" d,dramlatency " , " The current platform's dram latency " ,
40- cxxopts::value<double >()->default_value (" 110" ))(
39+ cxxopts::value<std::vector<int >>()->default_value (" 0,1,2,3" ))(
40+ " d,dramlatency " , " The current platform's dram latency " , cxxopts::value<double >()->default_value (" 110" ))(
4141 " p,pebsperiod" , " The pebs sample period" , cxxopts::value<int >()->default_value (" 10" ))(
4242 " m,mode" , " Page mode or cacheline mode" , cxxopts::value<std::string>()->default_value (" p" ))(
4343 " o,topology" , " The newick tree input for the CXL memory expander topology" ,
@@ -64,7 +64,8 @@ int main(int argc, char *argv[]) {
6464 " k,policy" , " The policy of CXL memory controller" ,
6565 cxxopts::value<std::vector<std::string>>()->default_value (" none,none,none,none" ))(
6666 " e,env" , " The environment variable for the CXL memory controller" ,
67- cxxopts::value<std::vector<std::string>>()->default_value (" OMP_NUM_THREADS=24" ));;
67+ cxxopts::value<std::vector<std::string>>()->default_value (" OMP_NUM_THREADS=24" ));
68+ ;
6869
6970 auto result = options.parse (argc, argv);
7071 if (result[" help" ].as <bool >()) {
@@ -130,7 +131,7 @@ int main(int argc, char *argv[]) {
130131 hybridPolicy->add_policy (new HeatAwareMigrationPolicy ());
131132 hybridPolicy->add_policy (new FrequencyBasedMigrationPolicy ());
132133 policy2 = hybridPolicy;
133- }else {
134+ } else {
134135 SPDLOG_ERROR (" Unknown migration policy: {}" , policy[1 ]);
135136 policy2 = new MigrationPolicy ();
136137 }
@@ -150,7 +151,7 @@ int main(int argc, char *argv[]) {
150151 policy4 = new FIFOPolicy ();
151152 } else if (policy[3 ] == " frequency" ) {
152153 policy4 = new FrequencyBasedInvalidationPolicy ();
153- } else {
154+ } else {
154155 SPDLOG_ERROR (" Unknown caching policy: {}" , policy[3 ]);
155156 policy4 = new CachingPolicy ();
156157 }
@@ -161,7 +162,7 @@ int main(int argc, char *argv[]) {
161162 for (auto i : cpuset) {
162163 if (!use_cpus || use_cpus & 1UL << i) {
163164 CPU_SET (i, &use_cpuset);
164- SPDLOG_DEBUG ( " use cpuid: {}{} " , i, use_cpus) ;
165+ std::cout << " use cpuid: " << i << " " << use_cpus << std::endl ;
165166 }
166167 }
167168
@@ -229,7 +230,7 @@ int main(int argc, char *argv[]) {
229230 sleep (1 );
230231 std::vector<const char *> envp;
231232 envp.emplace_back (" LD_PRELOAD=/root/.bpftime/libbpftime-agent.so" );
232- envp.emplace_back (" OMP_NUM_THREADS=24 " );
233+ envp.emplace_back (" OMP_NUM_THREADS=4 " );
233234 while (!env.empty ()) {
234235 envp.emplace_back (env.back ().c_str ());
235236 env.pop_back ();
@@ -308,15 +309,19 @@ int main(int argc, char *argv[]) {
308309 all_llcmiss = 0 , all_prefetch = 0 ;
309310 double writeback_latency;
310311 /* read BPFTIMERUNTIME sample */
311- if (mon.bpftime_ctx ->read (controller, &mon.after ->bpftime ) < 0 ) {
312- SPDLOG_ERROR (" [{}:{}:{}] Warning: Failed BPFTIMERUNTIME read" , i, mon.tgid , mon.tid );
313- }
314- /* read PEBS sample */
315- if (mon.pebs_ctx ->read (controller, &mon.after ->pebs ) < 0 ) {
316- SPDLOG_ERROR (" [{}:{}:{}] Warning: Failed PEBS read" , i, mon.tgid , mon.tid );
317- }
318- /* read LBR sample */
319- if (mon.lbr_ctx ->read (controller, &mon.after ->lbr ) < 0 ) {
312+ if (mon.is_process ) {
313+ if (mon.bpftime_ctx ->read (controller, &mon.after ->bpftime ) < 0 ) {
314+ SPDLOG_ERROR (" [{}:{}:{}] Warning: Failed BPFTIMERUNTIME read" , i, mon.tgid , mon.tid );
315+ }
316+
317+ /* read PEBS sample */
318+ if (mon.pebs_ctx ->read (controller, &mon.after ->pebs ) < 0 ) {
319+ SPDLOG_ERROR (" [{}:{}:{}] Warning: Failed PEBS read" , i, mon.tgid , mon.tid );
320+ }
321+ /* read LBR sample */
322+ if (mon.lbr_ctx ->read (controller, &mon.after ->lbr ) < 0 ) {
323+ SPDLOG_ERROR (" [{}:{}:{}] Warning: Failed LBR read" , i, mon.tgid , mon.tid );
324+ }
320325 }
321326 target_llcmiss = mon.after ->pebs .total - mon.before ->pebs .total ;
322327
@@ -342,8 +347,8 @@ int main(int argc, char *argv[]) {
342347 writeback_latency = (double )target_l2stall * avg_weight *
343348 (wb_cnt * target_llcmiss / (all_llcmiss + all_prefetch + 1 ) /
344349 (target_llchits + avg_weight * target_llcmiss + 1 ));
345- uint64_t emul_delay =0 ; // =
346- // (controller->latency_lat + controller->bandwidth_lat + writeback_latency) * 1000000;
350+ uint64_t emul_delay =
351+ (controller->latency_lat + controller->bandwidth_lat + writeback_latency) * 1000000 ;
347352
348353 SPDLOG_DEBUG (" [{}:{}:{}] pebs: total={}, " , i, mon.tgid , mon.tid , mon.after ->pebs .total );
349354
0 commit comments