Link processes and CPUs with the loom
This commit is contained in:
parent
54cf4d3409
commit
2d8b68bff2
@ -52,6 +52,12 @@ cpu_set_gindex(struct cpu *cpu, int64_t gindex)
|
||||
cpu->gindex = gindex;
|
||||
}
|
||||
|
||||
void
|
||||
cpu_set_loom(struct cpu *cpu, struct loom *loom)
|
||||
{
|
||||
cpu->loom = loom;
|
||||
}
|
||||
|
||||
void
|
||||
cpu_set_name(struct cpu *cpu, const char *name)
|
||||
{
|
||||
|
@ -37,6 +37,9 @@ struct cpu {
|
||||
/* Physical id: as reported by lscpu(1) */
|
||||
int phyid;
|
||||
|
||||
/* Required to find threads that can run in this CPU */
|
||||
struct loom *loom;
|
||||
|
||||
size_t nthreads;
|
||||
size_t nth_running;
|
||||
size_t nth_active;
|
||||
@ -66,6 +69,7 @@ void cpu_init_begin(struct cpu *cpu, int phyid, int is_virtual);
|
||||
int cpu_get_phyid(struct cpu *cpu);
|
||||
//int cpu_get_index(struct cpu *cpu);
|
||||
void cpu_set_gindex(struct cpu *cpu, int64_t gindex);
|
||||
void cpu_set_loom(struct cpu *cpu, struct loom *loom);
|
||||
void cpu_set_name(struct cpu *cpu, const char *name);
|
||||
int cpu_init_end(struct cpu *cpu);
|
||||
int cpu_connect(struct cpu *cpu, struct bay *bay, struct recorder *rec);
|
||||
|
@ -68,6 +68,7 @@ loom_init_begin(struct loom *loom, const char *name)
|
||||
loom->id = loom->name;
|
||||
|
||||
cpu_init_begin(&loom->vcpu, -1, 1);
|
||||
cpu_set_loom(&loom->vcpu, loom);
|
||||
|
||||
dbg("creating new loom %s", loom->id);
|
||||
|
||||
@ -121,6 +122,8 @@ loom_add_cpu(struct loom *loom, struct cpu *cpu)
|
||||
//DL_SORT2(loom->cpus, cmp_cpus, lprev, lnext); // Maybe?
|
||||
loom->ncpus++;
|
||||
|
||||
cpu_set_loom(cpu, loom);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -223,6 +226,8 @@ loom_add_proc(struct loom *loom, struct proc *proc)
|
||||
HASH_ADD_INT(loom->procs, pid, proc);
|
||||
loom->nprocs++;
|
||||
|
||||
proc_set_loom(proc, loom);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -95,6 +95,12 @@ proc_set_gindex(struct proc *proc, int64_t gindex)
|
||||
proc->gindex = gindex;
|
||||
}
|
||||
|
||||
void
|
||||
proc_set_loom(struct proc *proc, struct loom *loom)
|
||||
{
|
||||
proc->loom = loom;
|
||||
}
|
||||
|
||||
int
|
||||
proc_load_metadata(struct proc *proc, JSON_Object *meta)
|
||||
{
|
||||
|
@ -27,6 +27,10 @@ struct proc {
|
||||
int nthreads;
|
||||
struct thread *threads;
|
||||
|
||||
/* Required to find if a thread belongs to the same loom as a
|
||||
* CPU */
|
||||
struct loom *loom;
|
||||
|
||||
/* Loom list */
|
||||
struct proc *lnext;
|
||||
struct proc *lprev;
|
||||
@ -45,6 +49,7 @@ int proc_init_begin(struct proc *proc, const char *id);
|
||||
int proc_init_end(struct proc *proc);
|
||||
int proc_get_pid(struct proc *proc);
|
||||
void proc_set_gindex(struct proc *proc, int64_t gindex);
|
||||
void proc_set_loom(struct proc *proc, struct loom *loom);
|
||||
void proc_sort(struct proc *proc);
|
||||
int proc_load_metadata(struct proc *proc, JSON_Object *meta);
|
||||
struct thread *proc_find_thread(struct proc *proc, int tid);
|
||||
|
Loading…
Reference in New Issue
Block a user