static int dtrace_close(struct inode *inode, struct file *file)
{
- dtrace_state_t *state;
+ dtrace_state_t *state = file->private_data;
mutex_lock(&cpu_lock);
mutex_lock(&dtrace_lock);
/*
* If there is anonymous state, destroy that first.
*/
- state = file->private_data;
if (state->dts_anon) {
ASSERT(dtrace_anon.dta_state == NULL);
if (dtrace_helptrace_enabled) {
ASSERT(dtrace_helptrace_buffer == NULL);
- dtrace_helptrace_buffer = dtrace_vzalloc(
- dtrace_helptrace_bufsize);
+ dtrace_helptrace_buffer = vzalloc(dtrace_helptrace_bufsize);
dtrace_helptrace_next = 0;
}
void *dtrace_vzalloc_try(unsigned long size)
{
return __vmalloc(size,
- __GFP_IO | __GFP_FS | __GFP_NORETRY | __GFP_ZERO,
+ __GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_NORETRY |
+ __GFP_ZERO,
PAGE_KERNEL);
}
-/*
- * Allocate a chunk of virtual memory in kernel space, and zero it out.
- */
-void *dtrace_vzalloc(unsigned long size)
-{
- void *ptr = vmalloc(size);
-
- if (ptr == NULL)
- return NULL;
-
- return memset(ptr, 0, size);
-}
-
/*
* Return a duplicate copy of a string. If the specified string is NULL, this
* function returs a zero-length string.
#include "dtrace_dev.h"
#include "profile.h"
+/* #define OMNI_CYCLICS */
+/* #define PROBE_PCS */
+
#define PROF_NAMELEN 15
#define PROF_PROFILE 0
#define PROF_TICK 1
static ktime_t profile_interval_min = KTIME_INIT(0, NANOSEC / 5000);
static int profile_aframes = 0;
+#ifdef OMNI_CYCLICS
static int profile_rates[] = {
97, 199, 499, 997, 1999,
4001, 4999, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
};
+#endif
static int profile_ticks[] = {
1, 10, 100, 500, 1000,
5000, 0, 0, 0, 0,
struct pt_regs *regs = get_irq_regs();
unsigned long pc = 0, upc = 0;
-if (regs) {
+#ifdef PROBE_PCS
if (user_mode(regs))
upc = GET_IP(regs);
else
pc = GET_IP(regs);
-}
+#endif
dtrace_probe(prof->prof_id, pc, upc, 0, 0, 0);
}
+#ifdef OMNI_CYCLICS
static void profile_prof(void *arg)
{
profile_probe_percpu_t *pcpu = arg;
pcpu->profc_expected = ktime_add(pcpu->profc_expected,
pcpu->profc_interval);
-if (regs) {
+#ifdef PROBE_PCS
if (user_mode(regs))
upc = GET_IP(regs);
else
pc = GET_IP(regs);
-}
+#endif
dtrace_probe(prof->prof_id, pc, upc, ktime_to_ns(late), 0, 0);
}
kfree(pcpu);
}
+#endif
static void profile_create(ktime_t interval, const char *name, int kind)
{
char *prefix;
int kind;
} types[] = {
+#ifdef OMNI_CYCLIC
{ PROF_PREFIX_PROFILE, PROF_PROFILE },
+#endif
{ PROF_PREFIX_TICK, PROF_TICK },
{ NULL, 0 },
};
/*
* If no description was provided, provide all of our probes.
*/
+#ifdef OMNI_CYCLICS
for (i = 0; i < sizeof(profile_rates) / sizeof(int); i++) {
if ((rate = profile_rates[i]) == 0)
continue;
profile_create(ktime_set(0, NANOSEC / rate),
n, PROF_PROFILE);
}
+#endif
for (i = 0; i < sizeof(profile_ticks) / sizeof(int); i++) {
if ((rate = profile_ticks[i]) == 0)
when.cyt_when = ktime_set(0, 0);
prof->prof_cyclic = cyclic_add(&hdlr, &when);
+#ifdef OMNI_CYCLICS
} else {
ASSERT(prof->prof_kind == PROF_PROFILE);
omni.cyo_arg = prof;
prof->prof_cyclic = cyclic_add_omni(&omni);
+#endif
}
return 0;
{
profile_probe_t *prof = parg;
-if (prof->prof_cyclic == CYCLIC_NONE) return;
ASSERT(prof->prof_cyclic != CYCLIC_NONE);
ASSERT(mutex_is_locked(&cpu_lock));