summaryrefslogtreecommitdiffstats
path: root/drivers/misc/sgi-gru/gruhandles.c
diff options
context:
space:
mode:
authorJack Steiner <steiner@sgi.com>2009-04-02 16:59:06 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-02 19:05:06 -0700
commite56484da3aa550dace96cbf1202446231471d7e1 (patch)
tree547f067876c0610c989a268ce0b19ef6986ee302 /drivers/misc/sgi-gru/gruhandles.c
parenta24e5e1caf4875bbe09f328b5f4daef6d25ebcc4 (diff)
downloadop-kernel-dev-e56484da3aa550dace96cbf1202446231471d7e1.zip
op-kernel-dev-e56484da3aa550dace96cbf1202446231471d7e1.tar.gz
sgi-gru: add statistics to the GRU context management functions
Add statistics to the GRU context management functions. Signed-off-by: Jack Steiner <steiner@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/misc/sgi-gru/gruhandles.c')
-rw-r--r--drivers/misc/sgi-gru/gruhandles.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/misc/sgi-gru/gruhandles.c b/drivers/misc/sgi-gru/gruhandles.c
index 5b82e7d..9dcf5d8 100644
--- a/drivers/misc/sgi-gru/gruhandles.c
+++ b/drivers/misc/sgi-gru/gruhandles.c
@@ -35,6 +35,16 @@
/* Extract the status field from a kernel handle */
#define GET_MSEG_HANDLE_STATUS(h) (((*(unsigned long *)(h)) >> 16) & 3)
+struct mcs_op_statistic mcs_op_statistics[mcsop_last];
+
+static void update_mcs_stats(enum mcs_op op, unsigned long clks)
+{
+ atomic_long_inc(&mcs_op_statistics[op].count);
+ atomic_long_add(clks, &mcs_op_statistics[op].total);
+ if (mcs_op_statistics[op].max < clks)
+ mcs_op_statistics[op].max = clks;
+}
+
static void start_instruction(void *h)
{
unsigned long *w0 = h;
@@ -57,6 +67,8 @@ static int wait_instruction_complete(void *h, enum mcs_op opc)
if (GRU_OPERATION_TIMEOUT < (get_cycles() - start_time))
panic("GRU %p is malfunctioning\n", h);
}
+ if (gru_options & OPT_STATS)
+ update_mcs_stats(opc, get_cycles() - start_time);
return status;
}
OpenPOWER on IntegriCloud