b/arch/powerpc/platforms/cell/spufs/gang.c
@@ -82,6 +82,22 @@ void spu_gang_add_ctx(struct spu_gang *gang, struct
spu_context *ctx)
mutex_unlock(&gang->mutex);
}
+void update_gang_stats(struct spu_gang *gang, struct spu_context *ctx)
+{
+ int i;
+
+ for (i = 0; i < SPU_UTIL_MAX; i++)
+ gang->stats.times[i] += ctx->stats.times[i];
+ gang->stats.vol_ctx_switch += ctx->stats.vol_ctx_switch;
+ gang->stats.invol_ctx_switch += ctx->stats.invol_ctx_switch;
+ gang->stats.min_flt += ctx->stats.min_flt;
+ gang->stats.maj_flt += ctx->stats.maj_flt;
+ gang->stats.hash_flt += ctx->stats.hash_flt;
+ gang->stats.slb_flt += ctx->stats.slb_flt;
+ gang->stats.class2_intr += ctx->stats.class2_intr;
+ gang->stats.libassist += ctx->stats.libassist;
+}
+
void spu_gang_remove_ctx(struct spu_gang *gang, struct spu_context *ctx)
{
mutex_lock(&gang->mutex);
@@ -92,6 +108,7 @@ void spu_gang_remove_ctx(struct spu_gang *gang, struct
spu_context *ctx)
}
list_del_init(&ctx->gang_list);
gang->contexts--;
+ update_gang_stats(gang, ctx);
atomic_dec(&gang->nstarted);
if (spu_gang_runnable(gang)) {
ctx = list_first_entry(&gang->list,
b/arch/powerpc/platforms/cell/spufs/spufs.h
@@ -178,6 +178,23 @@ struct spu_gang {
int aff_flags;
struct spu *aff_ref_spu;
atomic_t aff_sched_count;
+
+ /* spu scheduler statistics for zombie ctxts */
+ struct {
+ enum spu_utilization_state util_state; /* N/A */
+ unsigned long long tstamp; /* N/A */
+ unsigned long long times[SPU_UTIL_MAX];
+ unsigned long long vol_ctx_switch;
+ unsigned long long invol_ctx_switch;
+ unsigned long long min_flt;
+ unsigned long long maj_flt;
+ unsigned long long hash_flt;
+ unsigned long long slb_flt;
+ unsigned long long slb_flt_base; /* N/A */
+ unsigned long long class2_intr;
+ unsigned long long class2_intr_base; /* N/A */
+ unsigned long long libassist;
+ } stats;
};
static inline int spu_gang_runnable(struct spu_gang *g)