/* *Arbitrarylargevaluechosentobesufficientlylargetominimizenoisebut *sufficientlysmalltocompletequickly.
*/ staticunsignedint nr_function_calls = 100000;
module_param(nr_function_calls, uint, 0);
MODULE_PARM_DESC(nr_function_calls, "How many times to call the relevant tracee");
/* *Thenumberofopsassociatedwithacallsiteaffectswhetheratracercan *becalleddirectlyorwhetherit'snecessarytogoviathelistfunc,which *canbesignificantlymoreexpensive.
*/ staticunsignedint nr_ops_relevant = 1;
module_param(nr_ops_relevant, uint, 0);
MODULE_PARM_DESC(nr_ops_relevant, "How many ftrace_ops to associate with the relevant tracee");
/* *Onarchitectureswhereallcallsitessharethesametrampoline,having *tracersenabledfordistinctfunctionscanforcetheuseofthelistfunc *andincuroverheadforallcallsites.
*/ staticunsignedint nr_ops_irrelevant;
module_param(nr_ops_irrelevant, uint, 0);
MODULE_PARM_DESC(nr_ops_irrelevant, "How many ftrace_ops to associate with the irrelevant tracee");
/* *OnarchitectureswithDYNAMIC_FTRACE_WITH_REGS,savingthefullpt_regscan *bemoreexpensivethanonlysavingtheminimalnecessaryregs.
*/ staticbool save_regs;
module_param(save_regs, bool, 0);
MODULE_PARM_DESC(save_regs, "Register ops with FTRACE_OPS_FL_SAVE_REGS (save all registers in the trampoline)");
staticbool assist_recursion;
module_param(assist_recursion, bool, 0);
MODULE_PARM_DESC(assist_reursion, "Register ops with FTRACE_OPS_FL_RECURSION");
staticbool assist_rcu;
module_param(assist_rcu, bool, 0);
MODULE_PARM_DESC(assist_reursion, "Register ops with FTRACE_OPS_FL_RCU");
/* *Bydefault,atrivialtracerisusedwhichimmediatelyreturnstomimimize *overhead.Sometimesaconsistencycheckusingamoreexpensivetraceris *desireable.
*/ staticbool check_count;
module_param(check_count, bool, 0);
MODULE_PARM_DESC(check_count, "Check that tracers are called the expected number of times\n");
/* *Usuallyit'snotinterestingtoleavetheopsregisteredafterthetest *runs,butsometimesitcanbeusefultoleavethemregisteredsothatthey *canbeinspectedthroughthetracefs'enabled_functions'file.
*/ staticbool persist;
module_param(persist, bool, 0);
MODULE_PARM_DESC(persist, "Successfully load module and leave ftrace ops registered after test completes\n");
ops = kcalloc(nr, sizeof(*ops), GFP_KERNEL); if (WARN_ON_ONCE(!ops)) return NULL;
for (unsignedint i = 0; i < nr; i++) {
ops[i].ops.func = func;
ops[i].ops.flags = flags;
WARN_ON_ONCE(ftrace_set_filter_ip(&ops[i].ops, (unsignedlong)tracee, 0, 0));
WARN_ON_ONCE(register_ftrace_function(&ops[i].ops));
}
return ops;
}
staticvoid ops_destroy(struct sample_ops *ops, int nr)
{ if (!ops) return;
for (unsignedint i = 0; i < nr; i++) {
WARN_ON_ONCE(unregister_ftrace_function(&ops[i].ops));
ftrace_free_filter(&ops[i].ops);
}
kfree(ops);
}
staticvoid ops_check(struct sample_ops *ops, int nr, unsignedint expected_count)
{ if (!ops || !check_count) return;
for (unsignedint i = 0; i < nr; i++) { if (ops->count == expected_count) continue;
pr_warn("Counter called %u times (expected %u)\n",
ops->count, expected_count);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.