aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/cell/spufs/file.c
diff options
context:
space:
mode:
authorAndre Detsch <adetsch@br.ibm.com>2007-07-20 15:39:33 -0400
committerArnd Bergmann <arnd@klappe.arndb.de>2007-07-20 15:41:50 -0400
commit27ec41d3a1d4df2b7cd190e93aad22ab86a72aa1 (patch)
tree6c9d5af3fc3c3cfbef390eb34caf4dc7e7a3913e /arch/powerpc/platforms/cell/spufs/file.c
parente840cfe6814d6f13ecb86cff7097ad7259df502e (diff)
[CELL] spufs: add spu stats in sysfs and ctx stat file in spufs
This patch exports per-context statistics in spufs as long as spu statistics in sysfs. It was formed by merging: "spufs: add spu stats in sysfs" From: Christoph Hellwig "spufs: add stat file to spufs" From: Christoph Hellwig "spufs: fix libassist accounting" From: Jeremy Kerr "spusched: fix spu utilization statistics" From: Luke Browning And some adjustments by myself, after suggestions on cbe-oss-dev. Having separate patches was making the review process harder than it should, as we end up integrating spus and ctx statistics accounting much more than it was on the first implementation. Signed-off-by: Andre Detsch <adetsch@br.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs/file.c')
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index fe164112b3d..9351db9472d 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -2079,14 +2079,26 @@ static const char *ctx_state_names[] = {
2079}; 2079};
2080 2080
2081static unsigned long long spufs_acct_time(struct spu_context *ctx, 2081static unsigned long long spufs_acct_time(struct spu_context *ctx,
2082 enum spuctx_execution_state state) 2082 enum spu_utilization_state state)
2083{ 2083{
2084 unsigned long time = ctx->stats.times[state]; 2084 struct timespec ts;
2085 unsigned long long time = ctx->stats.times[state];
2085 2086
2086 if (ctx->stats.execution_state == state) 2087 /*
2087 time += jiffies - ctx->stats.tstamp; 2088 * In general, utilization statistics are updated by the controlling
2089 * thread as the spu context moves through various well defined
2090 * state transitions, but if the context is lazily loaded its
2091 * utilization statistics are not updated as the controlling thread
2092 * is not tightly coupled with the execution of the spu context. We
2093 * calculate and apply the time delta from the last recorded state
2094 * of the spu context.
2095 */
2096 if (ctx->spu && ctx->stats.util_state == state) {
2097 ktime_get_ts(&ts);
2098 time += timespec_to_ns(&ts) - ctx->stats.tstamp;
2099 }
2088 2100
2089 return jiffies_to_msecs(time); 2101 return time / NSEC_PER_MSEC;
2090} 2102}
2091 2103
2092static unsigned long long spufs_slb_flts(struct spu_context *ctx) 2104static unsigned long long spufs_slb_flts(struct spu_context *ctx)
@@ -2121,11 +2133,11 @@ static int spufs_show_stat(struct seq_file *s, void *private)
2121 spu_acquire(ctx); 2133 spu_acquire(ctx);
2122 seq_printf(s, "%s %llu %llu %llu %llu " 2134 seq_printf(s, "%s %llu %llu %llu %llu "
2123 "%llu %llu %llu %llu %llu %llu %llu %llu\n", 2135 "%llu %llu %llu %llu %llu %llu %llu %llu\n",
2124 ctx_state_names[ctx->stats.execution_state], 2136 ctx_state_names[ctx->stats.util_state],
2125 spufs_acct_time(ctx, SPUCTX_UTIL_USER), 2137 spufs_acct_time(ctx, SPU_UTIL_USER),
2126 spufs_acct_time(ctx, SPUCTX_UTIL_SYSTEM), 2138 spufs_acct_time(ctx, SPU_UTIL_SYSTEM),
2127 spufs_acct_time(ctx, SPUCTX_UTIL_IOWAIT), 2139 spufs_acct_time(ctx, SPU_UTIL_IOWAIT),
2128 spufs_acct_time(ctx, SPUCTX_UTIL_LOADED), 2140 spufs_acct_time(ctx, SPU_UTIL_IDLE_LOADED),
2129 ctx->stats.vol_ctx_switch, 2141 ctx->stats.vol_ctx_switch,
2130 ctx->stats.invol_ctx_switch, 2142 ctx->stats.invol_ctx_switch,
2131 spufs_slb_flts(ctx), 2143 spufs_slb_flts(ctx),