void printCurrentTemperature(void *LB, double curWallTime) { TempAwareRefineLB *taalb = static_cast<TempAwareRefineLB *>(LB); int pe = CkMyPe(); float temp = taalb->getTemp(pe % taalb->physicalCoresPerNode); int freq = cpufreq_sysfs_read (pe % taalb->logicalCoresPerNode); fprintf(taalb->logFD, "%f, %d, %f, %d\n", curWallTime, pe, temp, freq); }
void CentralLB::BuildStatsMsg() { #if CMK_LBDB_ON // build and send stats const int osz = theLbdb->GetObjDataSz(); const int csz = theLbdb->GetCommDataSz(); int npes = CkNumPes(); CLBStatsMsg* msg = new CLBStatsMsg(osz, csz); _MEMCHECK(msg); msg->from_pe = CkMyPe(); #if (defined(_FAULT_MLOG_) || defined(_FAULT_CAUSAL_)) msg->step = step(); #endif //msg->serial = CrnRand(); /* theLbdb->TotalTime(&msg->total_walltime,&msg->total_cputime); theLbdb->IdleTime(&msg->idletime); theLbdb->BackgroundLoad(&msg->bg_walltime,&msg->bg_cputime); */ #if CMK_LB_CPUTIMER theLbdb->GetTime(&msg->total_walltime,&msg->total_cputime, &msg->idletime, &msg->bg_walltime,&msg->bg_cputime); #else theLbdb->GetTime(&msg->total_walltime,&msg->total_walltime, &msg->idletime, &msg->bg_walltime,&msg->bg_walltime); #endif #if defined(TEMP_LDB) float mytemp=getTemp(CkMyPe()%physicalCoresPerNode); int freq=cpufreq_sysfs_read (CkMyPe()%logicalCoresPerNode); msg->pe_temp=mytemp; msg->pe_speed=freq; #else msg->pe_speed = myspeed; #endif DEBUGF(("Processor %d Total time (wall,cpu) = %f %f Idle = %f Bg = %f %f\n", CkMyPe(),msg->total_walltime,msg->total_cputime,msg->idletime,msg->bg_walltime,msg->bg_cputime)); msg->n_objs = osz; theLbdb->GetObjData(msg->objData); msg->n_comm = csz; theLbdb->GetCommData(msg->commData); // theLbdb->ClearLoads(); DEBUGF(("PE %d BuildStatsMsg %d objs, %d comm\n",CkMyPe(),msg->n_objs,msg->n_comm)); if(CkMyPe() == cur_ld_balancer) { msg->avail_vector = new char[CkNumPes()]; LBDatabaseObj()->get_avail_vector(msg->avail_vector); msg->next_lb = LBDatabaseObj()->new_lbbalancer(); } CmiAssert(statsMsg == NULL); statsMsg = msg; #endif }
void measureFreq (int it, int total_itr) { if (cpufreq_sysfs_read (CkMyPe ()) == 1596000) lowFreq += 1; else highFreq += 1; if (it == total_itr - 1 && CkMyPe () % 4 == 0) printf ("PROC#%d ddddddddddddddddddddddddddddddddddddddddddddddddddd h=%d l=%d\n", CkMyPe (), highFreq, lowFreq); }
gboolean cpufreq_pstate_read (void) { /* gather intel pstate parameters */ if (!read_params ()) return FALSE; /* now read the number of cpus and the remaining cpufreq info for each of them from sysfs */ if (!cpufreq_sysfs_read ()) return FALSE; return TRUE; }
static GObject * cpufreq_monitor_sysfs_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_params) { GObject *object; gchar *path; gchar *frequency; gint max_freq; guint cpu; GError *error = NULL; object = G_OBJECT_CLASS ( cpufreq_monitor_sysfs_parent_class)->constructor (type, n_construct_properties, construct_params); g_object_get (G_OBJECT (object), "cpu", &cpu, NULL); path = g_strdup_printf (CPUFREQ_SYSFS_BASE_PATH, cpu, monitor_sysfs_files[CPUINFO_MAX]); frequency = cpufreq_sysfs_read (path, &error); if (!frequency) { g_warning ("%s", error->message); g_error_free (error); max_freq = -1; } else { max_freq = atoi (frequency); } g_free (path); g_free (frequency); g_object_set (G_OBJECT (object), "max-frequency", max_freq, NULL); return object; }
static gboolean cpufreq_monitor_sysfs_run (CPUFreqMonitor *monitor) { guint cpu; gchar *frequency; gchar *governor; gchar *path; GError *error = NULL; g_object_get (G_OBJECT (monitor), "cpu", &cpu, NULL); path = g_strdup_printf (CPUFREQ_SYSFS_BASE_PATH, cpu, monitor_sysfs_files[GOVERNOR]); governor = cpufreq_sysfs_read (path, &error); if (!governor) { gboolean retval = FALSE; /* Check whether it failed because * cpu is not online. */ if (!cpufreq_sysfs_cpu_is_online (cpu)) { g_object_set (G_OBJECT (monitor), "online", FALSE, NULL); retval = TRUE; } else { g_warning ("%s", error->message); } g_error_free (error); g_free (path); return retval; } g_free (path); if (g_ascii_strcasecmp (governor, "userspace") == 0) { path = g_strdup_printf (CPUFREQ_SYSFS_BASE_PATH, cpu, monitor_sysfs_files[SCALING_SETSPEED]); } else if (g_ascii_strcasecmp (governor, "powersave") == 0) { path = g_strdup_printf (CPUFREQ_SYSFS_BASE_PATH, cpu, monitor_sysfs_files[SCALING_MIN]); } else if (g_ascii_strcasecmp (governor, "performance") == 0) { path = g_strdup_printf (CPUFREQ_SYSFS_BASE_PATH, cpu, monitor_sysfs_files[SCALING_MAX]); } else { /* Ondemand, Conservative, ... */ path = g_strdup_printf (CPUFREQ_SYSFS_BASE_PATH, cpu, monitor_sysfs_files[SCALING_CUR_FREQ]); } frequency = cpufreq_sysfs_read (path, &error); if (!frequency) { g_warning ("%s", error->message); g_error_free (error); g_free (path); g_free (governor); return FALSE; } g_free (path); g_object_set (G_OBJECT (monitor), "online", TRUE, "governor", governor, "frequency", atoi (frequency), NULL); g_free (governor); g_free (frequency); return TRUE; }