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)
{
#ifdef CONFIG_INFINIBAND_SDP_DEBUG_DATA
#define SDP_PROFILING
#endif
-//#define GETNSTIMEODAY_SUPPORTED
#define SDP_WARN_ON(x) WARN_ON(x)
struct sk_buff *skb;
char msg[256];
- unsigned long long time;
+ cycles_t time;
const char *func;
int line;
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)]; \
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(); \
#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();
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)
{
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: