From e56484da3aa550dace96cbf1202446231471d7e1 Mon Sep 17 00:00:00 2001 From: Jack Steiner Date: Thu, 2 Apr 2009 16:59:06 -0700 Subject: sgi-gru: add statistics to the GRU context management functions Add statistics to the GRU context management functions. Signed-off-by: Jack Steiner Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/misc/sgi-gru/gruhandles.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'drivers/misc/sgi-gru/gruhandles.c') diff --git a/drivers/misc/sgi-gru/gruhandles.c b/drivers/misc/sgi-gru/gruhandles.c index 5b82e7def16..9dcf5d89668 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; } -- cgit v1.2.3