break;
}
buf[len] = 0;
- _sdp_printk(func, line, KERN_WARNING, sk, "%s: %s\n", str, buf);
+ if (sdp_data_debug_level & 0x1)
+ _sdp_printk(func, line, KERN_WARNING, sk, "%s: %s\n", str, buf);
_sdp_prf(sk, skb, func, line, "%s: %s", str, buf);
}
#endif
}
}
+static int inline sdpprf_first_idx(int count)
+{
+ return max(0, count - SDPPRF_LOG_SIZE) & (SDPPRF_LOG_SIZE - 1);
+}
+
static int sdpprf_show(struct seq_file *m, void *v)
{
struct sdpprf_log *l = v;
unsigned long usec_rem, t;
+ int count = atomic_read(&sdpprf_log_count);
+ int first = sdpprf_first_idx(count);
+ int idx = l - &sdpprf_log[0];
- if (!atomic_read(&sdpprf_log_count)) {
+ if (idx == first)
+ seq_printf(m, "Num log entries: %d\n", count);
+
+ if (!count) {
seq_printf(m, "No performance logs\n");
goto out;
}
static void *sdpprf_start(struct seq_file *p, loff_t *pos)
{
- int idx = *pos;
+ int count = atomic_read(&sdpprf_log_count);
+ int first = sdpprf_first_idx(count);
struct sdpprf_log *l = NULL;
- if (!*pos && !atomic_read(&sdpprf_log_count))
- return SEQ_START_TOKEN;
- if (*pos >= atomic_read(&sdpprf_log_count))
- return NULL;
+ if (!count)
+ return SEQ_START_TOKEN;
- if (atomic_read(&sdpprf_log_count) > 0 &&
- *pos >= MIN(atomic_read(&sdpprf_log_count), SDPPRF_LOG_SIZE))
+ if (*pos >= MIN(count, SDPPRF_LOG_SIZE))
return NULL;
- if (atomic_read(&sdpprf_log_count) > SDPPRF_LOG_SIZE)
- idx = atomic_read(&sdpprf_log_count) - SDPPRF_LOG_SIZE;
+ l = &sdpprf_log[(first + *pos) & (SDPPRF_LOG_SIZE - 1)];
- l = &sdpprf_log[idx & (SDPPRF_LOG_SIZE - 1)];
+ start_t = l->time;
- if (*pos == 0)
- start_t = l->time;
return l;
}