22 #ifndef USER_MONITORING_H
23 #define USER_MONITORING_H
39 MONITORING_MODULE(Power_Monitoring_old) {
50 TRACE_VAR_DOUBLE(previous_hyper_energy);
51 TRACE_VAR_DOUBLE(hyper_instant_energy);
52 TRACE_VAR_DOUBLE(total_current_power);
54 TRACE_VAR_DOUBLE(rz_reconf_current_power);
55 TRACE_VAR_DOUBLE(rz_hard_current_static_power);
56 TRACE_VAR_DOUBLE(rz_soft_current_idle_power);
57 TRACE_VAR_DOUBLE(rz_soft_current_static_power);
58 TRACE_VAR_DOUBLE(rz_hard_current_idle_power);
59 TRACE_VAR_DOUBLE(rz_hard_current_run_power);
60 TRACE_VAR_DOUBLE(rz_soft_current_run_power);
68 MONITORING_INIT(Power_Monitoring_old) {
72 total_current_power = 0;
73 previous_hyper_energy =0;
76 MONITORING_ADD_THREAD(Power_Monitoring_old, trace_update_thread);
94 MONITORING_ANALOG_TRACE(previous_hyper_energy,
"Previous_Hyper_Energy", 0, 100, 75);
95 MONITORING_ANALOG_TRACE(hyper_instant_energy,
"Hyper_Instant_Energy", 0, 100, 75);
96 MONITORING_ANALOG_TRACE(total_current_power,
"Instant_current", 0, 2000, 75);
98 MONITORING_ANALOG_TRACE(rz_reconf_current_power,
"Reconf_current", 0, 1000, 75);
99 MONITORING_ANALOG_TRACE(rz_hard_current_static_power,
"RZ_static_current", 0, 1000, 75);
100 MONITORING_ANALOG_TRACE(rz_hard_current_idle_power,
"RZ_idle_current", 0, 1000, 75);
101 MONITORING_ANALOG_TRACE(rz_hard_current_run_power,
"RZ_run_current", 0, 1000, 75);
102 MONITORING_ANALOG_TRACE(rz_soft_current_static_power,
"Cores_static_current", 0, 1000, 75);
103 MONITORING_ANALOG_TRACE(rz_soft_current_idle_power,
"Cores_idle_current", 0, 1000, 75);
104 MONITORING_ANALOG_TRACE(rz_soft_current_run_power,
"Cores_run_current", 0, 1000, 75);
112 MONITORING_THREAD(trace_update_thread) {
115 sc_time current_time(SC_ZERO_TIME);
116 sc_time previous_time(SC_ZERO_TIME);
119 total_current_power=0;
120 double rz_current_power=0;
121 rz_reconf_current_power=0;
122 rz_hard_current_static_power=0;
123 rz_soft_current_static_power=0;
124 rz_hard_current_idle_power=0;
125 rz_soft_current_idle_power=0;
126 rz_hard_current_run_power=0;
127 rz_soft_current_run_power=0;
142 double Pstatic, Pidle, Prun;
144 total_current_power=0;
146 rz_reconf_current_power=0;
147 rz_hard_current_static_power=0;
148 rz_soft_current_static_power=0;
149 rz_hard_current_idle_power=0;
150 rz_soft_current_idle_power=0;
151 rz_hard_current_run_power=0;
152 rz_soft_current_run_power=0;
155 while(i < (
int) all_RZs.size()) {
158 if (all_RZs.at(i)->get_implementation_type()==HARD)
160 Pstatic=P_STATIC_1CELL*all_RZs.at(i)->get_resources_ptr()->getResourceCount(
"Slice")*40;
161 Pidle=all_RZs.at(i)->getCurrentImplementation().getPidle();
162 Prun= all_RZs.at(i)->getCurrentImplementation().getPrun();
187 rz_current_power = Pstatic;
188 if (all_RZs.at(i)->get_implementation_type()==HARD)
190 rz_hard_current_static_power += rz_current_power;
193 rz_soft_current_static_power += rz_current_power;
205 if (all_RZs.at(i)->get_implementation_type()==HARD)
208 rz_hard_current_static_power += Pstatic;
209 rz_hard_current_idle_power += Pidle;
210 rz_current_power = Pstatic + Pidle;
215 rz_soft_current_idle_power += Pidle;
216 rz_current_power = Pidle;
222 if (all_RZs.at(i)->get_implementation_type()==HARD)
225 rz_hard_current_static_power += Pstatic;
226 rz_hard_current_idle_power += Pidle;
227 rz_hard_current_run_power += Prun;
228 rz_current_power = Pstatic + Pidle+ Prun;
234 rz_soft_current_run_power += Prun;
235 rz_current_power = Prun;
240 rz_current_power = Pstatic + P_RECONF;
241 if (all_RZs.at(i)->get_implementation_type()==HARD)
243 rz_hard_current_static_power += Pstatic;
248 rz_soft_current_static_power += Pstatic;
251 rz_reconf_current_power += P_RECONF;
257 total_current_power+=rz_current_power;
263 double hyper_period_step = (sc_time_stamp()-Application::getGlobalOffset())/Application::getGlobalHypeperiod();
265 if (hyper_period_step == (
long)hyper_period_step && new_period==1)
267 if (sc_time_stamp()>=Application::getGlobalOffset ())
268 current_time=sc_time_stamp()-Application::getGlobalOffset()-((long)hyper_period_step)*Application::getGlobalHypeperiod();
270 current_time=sc_time_stamp();
271 previous_time=current_time;
275 if (sc_time_stamp()>Application::getGlobalOffset ())
276 current_time=sc_time_stamp()-Application::getGlobalOffset()-(long)hyper_period_step*Application::getGlobalHypeperiod();
278 current_time=sc_time_stamp();
281 if ((current_time-previous_time).to_seconds()>5)
282 previous_time=current_time;
284 if (new_period==1 && previous_time!=current_time)
287 hyper_energy+=total_current_power*(current_time-previous_time).to_seconds();
301 if (hyper_period_step == (
long)hyper_period_step && new_period==0)
305 previous_hyper_energy=hyper_energy;
308 if (sc_time_stamp()>Application::getGlobalOffset ())
309 current_time=sc_time_stamp()-Application::getGlobalOffset()-(long)hyper_period_step*Application::getGlobalHypeperiod();
311 current_time=sc_time_stamp();
318 hyper_instant_energy = hyper_energy;
320 previous_time=current_time;
322 wait(sc_time(100, SC_US));
328 MONITORING_MODULE(Power_Monitoring) {
339 TRACE_VAR_DOUBLE(previous_hyper_energy);
340 TRACE_VAR_DOUBLE(app_energy);
341 TRACE_VAR_DOUBLE(previous_app_energy);
342 TRACE_VAR_DOUBLE(hyper_instant_energy);
343 TRACE_VAR_DOUBLE(total_current_power);
344 TRACE_VAR_DOUBLE(previous_app_time);
346 TRACE_VAR_DOUBLE(rz_reconf_current_power);
347 TRACE_VAR_DOUBLE(rz_hard_current_static_power);
348 TRACE_VAR_DOUBLE(rz_soft_current_idle_power);
349 TRACE_VAR_DOUBLE(rz_soft_current_static_power);
350 TRACE_VAR_DOUBLE(rz_hard_current_idle_power);
351 TRACE_VAR_DOUBLE(rz_hard_current_run_power);
352 TRACE_VAR_DOUBLE(rz_soft_current_run_power);
353 TRACE_VAR_DOUBLE(cpu_operating_point);
357 TRACE_VAR_DOUBLE(RZ1_v);
358 TRACE_VAR_DOUBLE(RZ1_f);
359 TRACE_VAR_DOUBLE(RZ2_v);
360 TRACE_VAR_DOUBLE(RZ2_f);
361 TRACE_VAR_DOUBLE(RZ3_v);
362 TRACE_VAR_DOUBLE(RZ3_f);
363 TRACE_VAR_DOUBLE(RZ4_v);
364 TRACE_VAR_DOUBLE(RZ4_f);
365 TRACE_VAR_DOUBLE(RZ5_v);
366 TRACE_VAR_DOUBLE(RZ5_f);
378 MONITORING_INIT(Power_Monitoring) {
382 total_current_power = 0;
383 previous_hyper_energy =0;
386 MONITORING_ADD_THREAD(Power_Monitoring, trace_update_thread_cpu);
392 MONITORING_ACTIVATE {
404 MONITORING_ANALOG_TRACE(previous_hyper_energy,
"Previous_Hyper_Energy", 0, 100, 75);
405 MONITORING_ANALOG_TRACE(app_energy,
"App_instant_Energy", 0, 100, 75);
406 MONITORING_ANALOG_TRACE(previous_app_energy,
"Previous_App_Energy", 0, 100, 75);
407 MONITORING_ANALOG_TRACE(hyper_instant_energy,
"Hyper_Instant_Energy", 0, 100, 75);
408 MONITORING_ANALOG_TRACE(total_current_power,
"Instant_current", 0, 2000, 75);
409 MONITORING_TRACE(previous_app_time,
"Previous_App_Time",
"decimal")
411 MONITORING_ANALOG_TRACE(rz_reconf_current_power,
"Reconf_current", 0, 1000, 75);
412 MONITORING_ANALOG_TRACE(rz_hard_current_static_power,
"RZ_static_current", 0, 1000, 75);
413 MONITORING_ANALOG_TRACE(rz_hard_current_idle_power,
"RZ_idle_current", 0, 1000, 75);
414 MONITORING_ANALOG_TRACE(rz_hard_current_run_power,
"RZ_run_current", 0, 1000, 75);
415 MONITORING_ANALOG_TRACE(rz_soft_current_static_power,
"Cores_static_current", 0, 1000, 75);
416 MONITORING_ANALOG_TRACE(rz_soft_current_idle_power,
"Cores_idle_current", 0, 1000, 75);
417 MONITORING_ANALOG_TRACE(rz_soft_current_run_power,
"Cores_run_current", 0, 1000, 75);
418 MONITORING_ANALOG_TRACE(cpu_operating_point,
"CPU_operating_point", 0, 2, 75);
421 MONITORING_TRACE(RZ1_v,
"OP_RZ1.V",
"decimal");
422 MONITORING_TRACE(RZ1_f,
"OP_RZ1.F",
"decimal");
423 MONITORING_TRACE(RZ2_v,
"OP_RZ2.V",
"decimal");
424 MONITORING_TRACE(RZ2_f,
"OP_RZ2.F",
"decimal");
425 MONITORING_TRACE(RZ3_v,
"OP_RZ3.V",
"decimal");
426 MONITORING_TRACE(RZ3_f,
"OP_RZ3.F",
"decimal");
427 MONITORING_TRACE(RZ4_v,
"OP_RZ4.V",
"decimal");
428 MONITORING_TRACE(RZ4_f,
"OP_RZ4.F",
"decimal");
429 MONITORING_TRACE(RZ5_v,
"OP_RZ5.V",
"decimal");
430 MONITORING_TRACE(RZ5_f,
"OP_RZ5.F",
"decimal");
441 MONITORING_THREAD(trace_update_thread_cpu) {
444 sc_time current_time(SC_ZERO_TIME);
445 sc_time previous_time(SC_ZERO_TIME);
446 sc_time app_time(SC_ZERO_TIME);
449 total_current_power=0;
450 double rz_current_power=0;
451 rz_reconf_current_power=0;
452 rz_hard_current_static_power=0;
453 rz_soft_current_static_power=0;
454 rz_hard_current_idle_power=0;
455 rz_soft_current_idle_power=0;
456 rz_hard_current_run_power=0;
457 rz_soft_current_run_power=0;
459 previous_app_energy=0;
462 int nb_Running_CPU=0;
465 double max_CPU_freq=PM_CPU_FREQUENCY;
466 double max_CPU_V=PM_CPU_VOLTAGE;
480 double Pstatic, Pidle, Prun;
482 total_current_power=0;
484 rz_reconf_current_power=0;
485 rz_hard_current_static_power=0;
486 rz_soft_current_static_power=0;
487 rz_hard_current_idle_power=0;
488 rz_soft_current_idle_power=0;
489 rz_hard_current_run_power=0;
490 rz_soft_current_run_power=0;
495 while(i < (
int) all_RZs.size()) {
498 if (all_RZs.at(i)->get_implementation_type()==HARD)
500 Pstatic=P_STATIC_1CELL*all_RZs.at(i)->get_resources_ptr()->getResourceCount(
"Slice")*40;
501 Pidle=all_RZs.at(i)->getCurrentImplementation().getPidle();
502 Prun= all_RZs.at(i)->getCurrentImplementation().getPrun();
510 double voltage = all_RZs.at(i)->getConfigFctPoint().getVoltage();
511 double frequency = all_RZs.at(i)->getConfigFctPoint().getFrequency();
513 float static_coeff = services.getRZProperties(all_RZs.at(i)->getName())->getConfigProcessor()->getType()->getStaticPowerCoeff();
514 float idle_coeff = services.getRZProperties(all_RZs.at(i)->getName())->getConfigProcessor()->getType()->getIdlePowerCoeff ();
516 rz_soft_current_static_power+= static_coeff*voltage;
517 rz_soft_current_idle_power += idle_coeff*voltage*voltage*frequency;
528 rz_current_power = 0;
529 if (all_RZs.at(i)->get_implementation_type()==HARD)
531 rz_hard_current_static_power += Pstatic;
532 rz_current_power+=Pstatic;
549 if (all_RZs.at(i)->get_implementation_type()==HARD)
552 rz_hard_current_static_power += Pstatic;
553 rz_hard_current_idle_power += Pidle;
554 rz_current_power = Pstatic + Pidle;
566 if (all_RZs.at(i)->get_implementation_type()==HARD)
569 rz_hard_current_static_power += Pstatic;
570 rz_hard_current_idle_power += Pidle;
571 rz_hard_current_run_power += Prun;
572 rz_current_power = Pstatic + Pidle+ Prun;
583 double voltage = all_RZs.at(i)->getConfigFctPoint().getVoltage();
584 double frequency = all_RZs.at(i)->getConfigFctPoint().getFrequency();
586 float run_coeff = services.getRZProperties(all_RZs.at(i)->getName())->getConfigProcessor()->getType()->getRunPowerCoeff ();
588 rz_soft_current_run_power +=run_coeff*voltage*voltage*frequency;
593 rz_current_power = Pstatic + P_RECONF;
594 if (all_RZs.at(i)->get_implementation_type()==HARD)
596 rz_hard_current_static_power += Pstatic;
604 rz_reconf_current_power += P_RECONF;
613 if (all_RZs.size()>0)
615 RZ1_v=all_RZs.at(0)->getConfigFctPoint().getVoltage();
616 RZ1_f=all_RZs.at(0)->getConfigFctPoint().getFrequency();
619 if (all_RZs.size()>1)
621 RZ2_v=all_RZs.at(1)->getConfigFctPoint().getVoltage();
622 RZ2_f=all_RZs.at(1)->getConfigFctPoint().getFrequency();
625 if (all_RZs.size()>2)
627 RZ3_v=all_RZs.at(2)->getConfigFctPoint().getVoltage();
628 RZ3_f=all_RZs.at(2)->getConfigFctPoint().getFrequency();
631 if (all_RZs.size()>3)
633 RZ4_v=all_RZs.at(3)->getConfigFctPoint().getVoltage();
634 RZ4_f=all_RZs.at(3)->getConfigFctPoint().getFrequency();
637 if (all_RZs.size()>4)
639 RZ5_v=all_RZs.at(4)->getConfigFctPoint().getVoltage();
640 RZ5_f=all_RZs.at(4)->getConfigFctPoint().getFrequency();
656 cpu_operating_point=global_operating_point;
662 total_current_power=rz_reconf_current_power+rz_hard_current_static_power+rz_hard_current_idle_power+rz_hard_current_run_power+rz_soft_current_static_power+rz_soft_current_idle_power+rz_soft_current_run_power;
665 double hyper_period_step = (sc_time_stamp()-Application::getGlobalOffset())/Application::getGlobalHypeperiod();
667 if (hyper_period_step == (
long)hyper_period_step && new_period==1)
669 if (sc_time_stamp()>=Application::getGlobalOffset ())
670 current_time=sc_time_stamp()-Application::getGlobalOffset()-((long)hyper_period_step)*Application::getGlobalHypeperiod();
672 current_time=sc_time_stamp();
673 previous_time=current_time;
677 if (sc_time_stamp()>Application::getGlobalOffset ())
678 current_time=sc_time_stamp()-Application::getGlobalOffset()-(long)hyper_period_step*Application::getGlobalHypeperiod();
680 current_time=sc_time_stamp();
683 if ((current_time-previous_time).to_seconds()>5)
684 previous_time=current_time;
686 if (new_period==1 && previous_time!=current_time)
689 hyper_energy+=total_current_power*(current_time-previous_time).to_seconds();
692 if (hyper_period_step == (
long)hyper_period_step && new_period==0)
696 previous_hyper_energy=hyper_energy;
699 previous_app_energy=app_energy;
700 previous_app_time=app_time.to_seconds()*1000*1000;
702 if (sc_time_stamp()>Application::getGlobalOffset ())
703 current_time=sc_time_stamp()-Application::getGlobalOffset()-(long)hyper_period_step*Application::getGlobalHypeperiod();
705 current_time=sc_time_stamp();
713 app_energy=hyper_energy;
716 app_time=current_time;
718 hyper_instant_energy = hyper_energy;
720 previous_time=current_time;
722 wait(sc_time(5, SC_US));
virtual Task_state Scheduler_get_task_state(int task_id)=0
Get task state.
virtual bool Scheduler_is_RZ_blank(RZ *rz)=0
Check if RZ is blank or used by a task.
virtual vector< RZ * > Scheduler_get_all_rz_vector(void)=0
Get the list of all reconfigurable zones used in the architecture.
Definition: scheduler_interface.h:138