]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sdp: fix for timestamping values in debug messages
authorEldad Zinger <eldadz@mellanox.co.il>
Tue, 28 Sep 2010 11:28:50 +0000 (13:28 +0200)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 6 Oct 2015 12:05:23 +0000 (05:05 -0700)
Signed-off-by: Eldad Zinger <eldadz@mellanox.co.il>
drivers/infiniband/ulp/sdp/sdp.h
drivers/infiniband/ulp/sdp/sdp_dbg.h
drivers/infiniband/ulp/sdp/sdp_main.c
drivers/infiniband/ulp/sdp/sdp_proc.c

index 1f916c247b413afd39f5102989dab52c1937f70b..598a1d5f208a0c65c7623650cac56c1c3db2ac5f 100644 (file)
@@ -518,6 +518,17 @@ static inline int tx_slots_free(struct sdp_sock *ssk)
        return min_free - SDP_MIN_TX_CREDITS;
 };
 
+static inline unsigned sdp_cycles_to_usecs(unsigned long c)
+{
+#ifdef CONFIG_PPC
+       return c / tb_ticks_per_usec;
+#elif defined(__ia64__)
+       return c / local_cpu_data->cyc_per_usec;
+#else
+       return c * 1000 / cpu_khz;
+#endif
+}
+
 /* utilities */
 static inline char *mid2str(int mid)
 {
index 7353da0cce120110d0b3a5e5f245dff8ea763152..f9a8a637e2611e66ad1c2b16d248379df8ee17e9 100644 (file)
@@ -6,7 +6,6 @@
 #ifdef CONFIG_INFINIBAND_SDP_DEBUG_DATA
 #define SDP_PROFILING
 #endif
-//#define GETNSTIMEODAY_SUPPORTED
 
 #define SDP_WARN_ON(x) WARN_ON(x)
 
@@ -48,7 +47,7 @@ struct sdpprf_log {
        struct sk_buff  *skb;
        char            msg[256];
 
-       unsigned long long time;
+       cycles_t time;
 
        const char      *func;
        int             line;
@@ -59,17 +58,6 @@ struct sdpprf_log {
 extern struct sdpprf_log sdpprf_log[SDPPRF_LOG_SIZE];
 extern int sdpprf_log_count;
 
-#ifdef GETNSTIMEODAY_SUPPORTED
-static inline unsigned long long current_nsec(void)
-{
-       struct timespec tv;
-       getnstimeofday(&tv);
-       return tv.tv_sec * NSEC_PER_SEC + tv.tv_nsec;
-}
-#else
-#define current_nsec() jiffies_to_usecs(jiffies)
-#endif
-
 #define _sdp_prf(sk, s, _func, _line, format, arg...) ({ \
        struct sdpprf_log *l = \
                &sdpprf_log[sdpprf_log_count++ & (SDPPRF_LOG_SIZE - 1)]; \
@@ -81,7 +69,7 @@ static inline unsigned long long current_nsec(void)
        l->cpu = smp_processor_id(); \
        l->skb = s; \
        snprintf(l->msg, sizeof(l->msg) - 1, format, ## arg); \
-       l->time = current_nsec(); \
+       l->time = get_cycles(); \
        l->func = _func; \
        l->line = _line; \
        preempt_enable(); \
index aefd386a8c35663f7fbfe7028623bbda5e03c235..d8ddce62afd1e11c7c96997aab0724a79ba38a30 100644 (file)
@@ -1373,17 +1373,6 @@ static inline cycles_t sdp_usec_to_cycles(int usecs)
 #endif
 }
 
-static inline unsigned sdp_cycles_to_usecs(unsigned long c)
-{
-#ifdef CONFIG_PPC
-       return c / tb_ticks_per_usec;
-#elif defined(__ia64__)
-       return c / local_cpu_data->cyc_per_usec;
-#else
-       return c * 1000 / cpu_khz;
-#endif
-}
-
 static inline int poll_recv_cq(struct sock *sk)
 {
        cycles_t start = get_cycles();
index 9f94c2b4390fef2f9e569078f6361a00d676e14a..99006dd7e7278a0ff426399b6edadda9ed284df0 100644 (file)
@@ -393,7 +393,7 @@ static struct file_operations sdpstats_fops = {
 struct sdpprf_log sdpprf_log[SDPPRF_LOG_SIZE];
 int sdpprf_log_count;
 
-static unsigned long long start_t;
+static cycles_t start_t;
 
 static inline void remove_newline(char *s)
 {
@@ -407,19 +407,19 @@ static inline void remove_newline(char *s)
 static int sdpprf_show(struct seq_file *m, void *v)
 {
        struct sdpprf_log *l = v;
-       unsigned long nsec_rem, t;
+       unsigned long usec_rem, t;
 
        if (!sdpprf_log_count) {
                seq_printf(m, "No performance logs\n");
                goto out;
        }
 
-       t = l->time - start_t;
-       nsec_rem = do_div(t, 1000000000);
+       t = sdp_cycles_to_usecs(l->time - start_t);
+       usec_rem = do_div(t, USEC_PER_SEC);
        remove_newline(l->msg);
        seq_printf(m, "%-6d: [%5lu.%06lu] %-50s - [%d{%d} %d:%d] "
                        "skb: %p %s:%d\n",
-                       l->idx, (unsigned long)t, nsec_rem/1000,
+                       l->idx, t, usec_rem,
                        l->msg, l->pid, l->cpu, l->sk_num, l->sk_dport,
                        l->skb, l->func, l->line);
 out: