static void kernel_common(struct parse_result *res, int pass) { static char old_mode [15]; static double start_time; if (pass == 1) { init_traces(); find_or_add_task_trace(res->pname, res->pid, 0); } if (pass == 2) { if (strcmp(old_mode, res->mode)) emit_trace(&mode, (union ltt_value)res->mode); memcpy(old_mode, res->mode, sizeof(old_mode)); old_mode[sizeof(old_mode)-1] = 0; /* 300 ms average for cpu load */ if (res->clock - start_time > 0.3) { double idle_run = emit_cpu_idle_state(res, (union ltt_value)(char *)NULL); if (start_time > 0) { emit_trace(&cpu_load, (union ltt_value)(1.0-idle_run/(res->clock - start_time))); } start_time = res->clock; } } }
static void init_primedata(primedata *S) { long i, j, l, lff = lg(S->ff), v = fetch_var(), N = degpol(S->pol); GEN T, p = S->p; if (S->lcm == degpol(S->ff[lff-1])) { T = shallowcopy((GEN)S->ff[lff-1]); setvarn(T, v); } else T = init_Fq(p, S->lcm, v); name_var(v,"y"); S->T = T; S->firstroot = cgetg(lff, t_VECSMALL); S->interp = cgetg(lff, t_VEC); S->fk = cgetg(N+1, t_VEC); for (l=1,j=1; j<lff; j++) { /* compute roots and fix ordering (Frobenius cycles) */ GEN F = FpX_factorff_irred(gel(S->ff,j), T, p); gel(S->interp,j) = interpol(F,T,p); S->firstroot[j] = l; for (i=1; i<lg(F); i++,l++) S->fk[l] = F[i]; } S->Trk = init_traces(S->ff, T,p); S->bezoutC = get_bezout(S->pol, S->ff, p); }
static void kernel_page_fault_get_user_exit_process(struct ltt_module *mod, struct parse_result *res, int pass) { if (pass == 1) { init_traces(); } if (pass == 2) { emit_trace(&trace_fault[2], (union ltt_value)LT_IDLE); } }
static void kernel_page_fault_get_user_entry_process(struct ltt_module *mod, struct parse_result *res, int pass) { int wr; unsigned long long address; if (pass == 1) { init_traces(); } if (sscanf(res->values, " address = %llx, write_access = %d", &address, &wr) != 2) { PARSE_ERROR(mod, res->values); return; } if (pass == 2) { emit_trace(&trace_fault[2], (union ltt_value)(wr?LT_S2:LT_S0)); emit_trace(&trace_fault[3], (union ltt_value)"%c@0x%08x", (wr)? 'W' : 'R', (uint32_t)address); } }
static void kernel_page_fault_exit_process(struct ltt_module *mod, struct parse_result *res, int pass) { int fault; if (pass == 1) { init_traces(); } if (sscanf(res->values, " res = %d", &fault) != 1) { PARSE_ERROR(mod, res->values); return; } if (pass == 2) { emit_trace(&trace_fault[0], (union ltt_value)LT_IDLE); emit_trace(&trace_fault[1], (union ltt_value)"-> %d", fault); } }
static void kernel_page_fault_entry_process(struct ltt_module *mod, struct parse_result *res, int pass) { int wr; unsigned long ip; unsigned long address; if (pass == 1) { init_traces(); } if (sscanf(res->values, " ip = %lx, address = %lx, trap_id = 14, write_access = %d", &ip, &address, &wr) != 3) { PARSE_ERROR(mod, res->values); return; } if (pass == 2) { emit_trace(&trace_fault[0], (union ltt_value)(wr?LT_S2:LT_S0)); emit_trace(&trace_fault[1], (union ltt_value)"0x%08x@%c0x%08x", ip, (wr)? 'W' : 'R', (uint32_t)address); } }
static void kernel_parrot_evt_stop_process(struct ltt_module *mod, struct parse_result *res, int pass) { int id; kernel_common(res, pass); if (sscanf(res->values, " id = %d", &id) != 1) { PARSE_ERROR(mod, res->values); return; } if (pass == 1) { init_traces(); if (id < sizeof(parrot_evt_n)/sizeof(parrot_evt_n[0]) && id >= 0) init_trace(&parrot_evt_n[id], TG_PROCESS, 0.0+0.1*id, TRACE_SYM_F_BITS, "kernel event %d", id); } if (pass == 2) { emit_trace(&parrot_evt, (union ltt_value)"%d->", id); if (id < sizeof(parrot_evt_n)/sizeof(parrot_evt_n[0]) && id >= 0) emit_trace(&parrot_evt_n[id], (union ltt_value)LT_IDLE); } }