Commit 556557eb authored by Duncan Coutts's avatar Duncan Coutts

Use a struct for the set of spark counters

parent ededf355
......@@ -94,11 +94,11 @@ findSpark (Capability *cap)
// slower (prsa) and doesn't affect the others.
spark = tryStealSpark(cap->sparks);
while (spark != NULL && fizzledSpark(spark)) {
cap->sparks_fizzled++;
cap->spark_stats.fizzled++;
spark = tryStealSpark(cap->sparks);
}
if (spark != NULL) {
cap->sparks_converted++;
cap->spark_stats.converted++;
// Post event for running a spark from capability's own pool.
traceEventRunSpark(cap, cap->r.rCurrentTSO);
......@@ -127,7 +127,7 @@ findSpark (Capability *cap)
spark = tryStealSpark(robbed->sparks);
while (spark != NULL && fizzledSpark(spark)) {
cap->sparks_fizzled++;
cap->spark_stats.fizzled++;
spark = tryStealSpark(robbed->sparks);
}
if (spark == NULL && !emptySparkPoolCap(robbed)) {
......@@ -137,7 +137,7 @@ findSpark (Capability *cap)
}
if (spark != NULL) {
cap->sparks_converted++;
cap->spark_stats.converted++;
traceEventStealSpark(cap, cap->r.rCurrentTSO, robbed->no);
......@@ -232,11 +232,11 @@ initCapability( Capability *cap, nat i )
cap->returning_tasks_hd = NULL;
cap->returning_tasks_tl = NULL;
cap->inbox = (Message*)END_TSO_QUEUE;
cap->sparks_created = 0;
cap->sparks_dud = 0;
cap->sparks_converted = 0;
cap->sparks_gcd = 0;
cap->sparks_fizzled = 0;
cap->spark_stats.created = 0;
cap->spark_stats.dud = 0;
cap->spark_stats.converted = 0;
cap->spark_stats.gcd = 0;
cap->spark_stats.fizzled = 0;
#endif
cap->f.stgEagerBlackholeInfo = (W_)&__stg_EAGER_BLACKHOLE_info;
......
......@@ -98,11 +98,7 @@ struct Capability_ {
SparkPool *sparks;
// Stats on spark creation/conversion
nat sparks_created;
nat sparks_dud;
nat sparks_converted;
nat sparks_gcd;
nat sparks_fizzled;
SparkCounters spark_stats;
#endif
// Per-capability STM-related data
......
......@@ -65,9 +65,9 @@ newSpark (StgRegTable *reg, StgClosure *p)
if (!fizzledSpark(p)) {
pushWSDeque(pool,p);
cap->sparks_created++;
cap->spark_stats.created++;
} else {
cap->sparks_dud++;
cap->spark_stats.dud++;
}
return 1;
......@@ -173,7 +173,7 @@ pruneSparkQueue (Capability *cap)
// evaluated, but it doesn't hurt to have this check for
// robustness.
pruned_sparks++;
cap->sparks_fizzled++;
cap->spark_stats.fizzled++;
} else {
info = spark->header.info;
if (IS_FORWARDING_PTR(info)) {
......@@ -185,7 +185,7 @@ pruneSparkQueue (Capability *cap)
n++;
} else {
pruned_sparks++; // discard spark
cap->sparks_fizzled++;
cap->spark_stats.fizzled++;
}
} else if (HEAP_ALLOCED(spark)) {
if ((Bdescr((P_)spark)->flags & BF_EVACUATED)) {
......@@ -195,11 +195,11 @@ pruneSparkQueue (Capability *cap)
n++;
} else {
pruned_sparks++; // discard spark
cap->sparks_fizzled++;
cap->spark_stats.fizzled++;
}
} else {
pruned_sparks++; // discard spark
cap->sparks_gcd++;
cap->spark_stats.gcd++;
}
} else {
if (INFO_PTR_TO_STRUCT(info)->type == THUNK_STATIC) {
......@@ -209,11 +209,11 @@ pruneSparkQueue (Capability *cap)
n++;
} else {
pruned_sparks++; // discard spark
cap->sparks_gcd++;
cap->spark_stats.gcd++;
}
} else {
pruned_sparks++; // discard spark
cap->sparks_fizzled++;
cap->spark_stats.fizzled++;
}
}
}
......
......@@ -15,6 +15,15 @@
/* typedef for SparkPool in RtsTypes.h */
/* Stats on spark creation/conversion */
typedef struct {
StgWord created;
StgWord dud;
StgWord converted;
StgWord gcd;
StgWord fizzled;
} SparkCounters;
#if defined(THREADED_RTS)
typedef WSDeque SparkPool;
......
......@@ -629,21 +629,19 @@ stat_exit(int alloc)
{
nat i;
lnat sparks_created = 0;
lnat sparks_dud = 0;
lnat sparks_converted = 0;
lnat sparks_gcd = 0;
lnat sparks_fizzled = 0;
SparkCounters sparks = { 0, 0, 0, 0, 0};
for (i = 0; i < n_capabilities; i++) {
sparks_created += capabilities[i].sparks_created;
sparks_dud += capabilities[i].sparks_dud;
sparks_converted += capabilities[i].sparks_converted;
sparks_gcd += capabilities[i].sparks_gcd;
sparks_fizzled += capabilities[i].sparks_fizzled;
sparks.created += capabilities[i].spark_stats.created;
sparks.dud += capabilities[i].spark_stats.dud;
sparks.converted += capabilities[i].spark_stats.converted;
sparks.gcd += capabilities[i].spark_stats.gcd;
sparks.fizzled += capabilities[i].spark_stats.fizzled;
}
statsPrintf(" SPARKS: %ld (%ld converted, %ld dud, %ld GC'd, %ld fizzled)\n\n",
sparks_created + sparks_dud, sparks_converted, sparks_dud, sparks_gcd, sparks_fizzled);
sparks.created + sparks.dud,
sparks.converted, sparks.dud,
sparks.gcd, sparks.fizzled);
}
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment