|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 12 of 12] xenalyze: Make max_active_pcpu calculation smarter
oprofile reports that during summary runs, over 30% of the
time processing is spent in choose_next_record. As a first
step towards eliminating the loop found in that function,
take out the calculation of P.max_active_pcpu, and make it
smarter.
Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
diff -r b7d88a8858b7 -r 223e8ad4c755 xenalyze.c
--- a/xenalyze.c Mon Nov 28 16:16:23 2011 +0000
+++ b/xenalyze.c Mon Nov 28 16:16:23 2011 +0000
@@ -8675,6 +8675,21 @@ void deactivate_pcpu(struct pcpu_info *p
lose_vcpu(p->current, p->last_tsc);
}
p->active = 0;
+ if ( p->pid == P.max_active_pcpu )
+ {
+ int i, max_active_pcpu = -1;
+ for(i=0; i<=P.max_active_pcpu; i++)
+ {
+ if(!P.pcpu[i].active)
+ continue;
+
+ max_active_pcpu = i;
+ }
+ P.max_active_pcpu = max_active_pcpu;
+ fprintf(warn, "%s: Setting max_active_pcpu to %d\n",
+ __func__, max_active_pcpu);
+ }
+
}
/* Helper function to process tsc-related record info */
@@ -9304,17 +9319,20 @@ char * pcpu_string(int pcpu)
struct pcpu_info * choose_next_record(void)
{
- int i, max_active_pcpu = -1;
+ int i;
struct pcpu_info * p, *min_p=NULL;
loff_t min_offset = 0;
+ /* Need to:
+ * - find the pcpu with the lowest order_tsc
+ * - Find the lowest file offset
+ */
for(i=0; i<=P.max_active_pcpu; i++)
{
p = P.pcpu+i;
if(!p->active)
continue;
- max_active_pcpu = i;
if(!min_p || p->order_tsc < min_p->order_tsc)
min_p = p;
@@ -9322,13 +9340,11 @@ struct pcpu_info * choose_next_record(vo
min_offset = p->file_offset;
}
- P.max_active_pcpu = max_active_pcpu;
-
if(opt.progress && min_offset >= G.progress.update_offset)
progress_update(min_offset);
/* If there are active pcpus, make sure we chose one */
- assert(min_p || (max_active_pcpu==-1));
+ assert(min_p || (P.max_active_pcpu==-1));
return min_p;
}
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |