Esempio n. 1
0
/**
 * @brief Reads monitoring event data
 */
static void monitoring_loop(void)
{
        unsigned mon_number = 0;
	int ret = PQOS_RETVAL_OK;
	int i = 0;

	if (signal(SIGINT, monitoring_ctrlc) == SIG_ERR)
		printf("Failed to catch SIGINT!\n");

        if (!process_mode())
	        mon_number = (unsigned) sel_monitor_num;
	else
	        mon_number = (unsigned) sel_process_num;

	while (1) {
                ret = pqos_mon_poll(m_mon_grps, (unsigned)mon_number);
                if (ret != PQOS_RETVAL_OK) {
                        printf("Failed to poll monitoring data!\n");
                        return;
                }
                if (!process_mode()) {
                        printf("    CORE     RMID    LLC[KB]"
                               "    MBL[MB]    MBR[MB]\n");
                        for (i = 0; i < sel_monitor_num; i++) {
                                const struct pqos_event_values *pv =
                                        &m_mon_grps[i]->values;
                                double llc = bytes_to_kb(pv->llc);
                                double mbr = bytes_to_mb(pv->mbm_remote_delta);
                                double mbl = bytes_to_mb(pv->mbm_local_delta);

                                printf("%8u %8u %10.1f %10.1f %10.1f\n",
                                       m_mon_grps[i]->cores[0],
                                       m_mon_grps[i]->poll_ctx[0].rmid,
                                       llc, mbl, mbr);
                        }
                } else {
                        printf("PID       LLC[KB]\n");
                        for (i = 0; i < sel_process_num; i++) {
                                const struct pqos_event_values *pv =
                                        &m_mon_grps[i]->values;
                                double llc = bytes_to_kb(pv->llc);

                                printf("%6d %10.1f\n",
                                       m_mon_grps[i]->pid, llc);
                        }
                }
		printf("\nPress Enter to continue or Ctrl+c to exit");
		if (getchar() != '\n')
			break;
		printf("\e[1;1H\e[2J");
	}
}
static void rdt_dump_data(void) {
  /*
   * CORE - monitored group of cores
   * RMID - Resource Monitoring ID associated with the monitored group
   * LLC - last level cache occupancy
   * MBL - local memory bandwidth
   * MBR - remote memory bandwidth
   */
  DEBUG("  CORE     RMID    LLC[KB]   MBL[MB]    MBR[MB]");
  for (size_t i = 0; i < g_rdt->num_groups; i++) {
    const struct pqos_event_values *pv = &g_rdt->pgroups[i]->values;

    double llc = bytes_to_kb(pv->llc);
    double mbr = bytes_to_mb(pv->mbm_remote_delta);
    double mbl = bytes_to_mb(pv->mbm_local_delta);

    DEBUG(" [%s] %8u %10.1f %10.1f %10.1f", g_rdt->cores.cgroups[i].desc,
          g_rdt->pgroups[i]->poll_ctx[0].rmid, llc, mbl, mbr);
  }
}