WIP: Allow breakdown for OpenMP without nOS-V

This commit is contained in:
Rodrigo Arias 2024-11-21 09:58:48 +01:00
parent 5ca0fcaed3
commit 8d78abd07f
2 changed files with 23 additions and 7 deletions

View File

@ -80,6 +80,20 @@ model_nosv_breakdown_create(struct emu *emu)
struct nosv_emu *memu = EXT(emu, 'V'); struct nosv_emu *memu = EXT(emu, 'V');
struct nosv_breakdown_emu *bemu = &memu->breakdown; struct nosv_breakdown_emu *bemu = &memu->breakdown;
/* Ensure all threads have breakdown enabled */
bemu->enabled = 1;
for (struct thread *th = emu->system.threads; th; th = th->gnext) {
if (check_thread_metadata(th) != 0) {
err("bad nosv metadata in thread: %s", th->id);
bemu->enabled = 0;
}
}
if (!bemu->enabled) {
warn("cannot enable breakdown for nOS-V model");
return 0;
}
/* Count phy cpus */ /* Count phy cpus */
struct system *sys = &emu->system; struct system *sys = &emu->system;
int64_t nphycpus = (int64_t) (sys->ncpus - sys->nlooms); int64_t nphycpus = (int64_t) (sys->ncpus - sys->nlooms);
@ -111,13 +125,6 @@ model_nosv_breakdown_create(struct emu *emu)
} }
} }
for (struct thread *th = emu->system.threads; th; th = th->gnext) {
if (check_thread_metadata(th) != 0) {
err("bad nosv metadata in thread: %s", th->id);
return -1;
}
}
return 0; return 0;
} }
@ -241,6 +248,10 @@ model_nosv_breakdown_connect(struct emu *emu)
struct nosv_emu *memu = EXT(emu, 'V'); struct nosv_emu *memu = EXT(emu, 'V');
struct nosv_breakdown_emu *bemu = &memu->breakdown; struct nosv_breakdown_emu *bemu = &memu->breakdown;
if (!bemu->enabled)
return 0;
struct bay *bay = &emu->bay; struct bay *bay = &emu->bay;
struct system *sys = &emu->system; struct system *sys = &emu->system;
@ -290,6 +301,10 @@ model_nosv_breakdown_finish(struct emu *emu,
struct nosv_emu *memu = EXT(emu, 'V'); struct nosv_emu *memu = EXT(emu, 'V');
struct nosv_breakdown_emu *bemu = &memu->breakdown; struct nosv_breakdown_emu *bemu = &memu->breakdown;
if (!bemu->enabled)
return 0;
struct pcf *pcf = pvt_get_pcf(bemu->pvt); struct pcf *pcf = pvt_get_pcf(bemu->pvt);
long typeid = PRV_NOSV_BREAKDOWN; long typeid = PRV_NOSV_BREAKDOWN;
char label[] = "CPU: nOS-V Runtime/Idle/Task breakdown"; char label[] = "CPU: nOS-V Runtime/Idle/Task breakdown";

View File

@ -51,6 +51,7 @@ struct nosv_breakdown_emu {
int64_t nphycpus; int64_t nphycpus;
struct sort sort; struct sort sort;
struct pvt *pvt; struct pvt *pvt;
int enabled;
}; };
#endif /* BREAKDOWN_H */ #endif /* BREAKDOWN_H */