€•xPŒsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ7/translations/zh_CN/trace/rv/da_monitor_instrumentation”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ7/translations/zh_TW/trace/rv/da_monitor_instrumentation”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ7/translations/it_IT/trace/rv/da_monitor_instrumentation”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ7/translations/ja_JP/trace/rv/da_monitor_instrumentation”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ7/translations/ko_KR/trace/rv/da_monitor_instrumentation”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ7/translations/sp_SP/trace/rv/da_monitor_instrumentation”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒ&Deterministic Automata Instrumentation”h]”hŒ&Deterministic Automata Instrumentation”…””}”(hh¨hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hh£hžhhŸŒQ/var/lib/git/docbuild/linux/Documentation/trace/rv/da_monitor_instrumentation.rst”h KubhŒ paragraph”“”)”}”(hŒtThe RV monitor file created by dot2k, with the name "$MODEL_NAME.c" includes a section dedicated to instrumentation.”h]”hŒxThe RV monitor file created by dot2k, with the name “$MODEL_NAME.c†includes a section dedicated to instrumentation.”…””}”(hh¹hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Khh£hžhubh¸)”}”(hŒIIn the example of the wip.dot monitor created on [1], it will look like::”h]”hŒHIn the example of the wip.dot monitor created on [1], it will look like:”…””}”(hhÇhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Khh£hžhubhŒ literal_block”“”)”}”(hX®/* * This is the instrumentation part of the monitor. * * This is the section where manual work is required. Here the kernel events * are translated into model's event. * */ static void handle_preempt_disable(void *data, /* XXX: fill header */) { da_handle_event_wip(preempt_disable_wip); } static void handle_preempt_enable(void *data, /* XXX: fill header */) { da_handle_event_wip(preempt_enable_wip); } static void handle_sched_waking(void *data, /* XXX: fill header */) { da_handle_event_wip(sched_waking_wip); } static int enable_wip(void) { int retval; retval = da_monitor_init_wip(); if (retval) return retval; rv_attach_trace_probe("wip", /* XXX: tracepoint */, handle_preempt_disable); rv_attach_trace_probe("wip", /* XXX: tracepoint */, handle_preempt_enable); rv_attach_trace_probe("wip", /* XXX: tracepoint */, handle_sched_waking); return 0; }”h]”hX®/* * This is the instrumentation part of the monitor. * * This is the section where manual work is required. Here the kernel events * are translated into model's event. * */ static void handle_preempt_disable(void *data, /* XXX: fill header */) { da_handle_event_wip(preempt_disable_wip); } static void handle_preempt_enable(void *data, /* XXX: fill header */) { da_handle_event_wip(preempt_enable_wip); } static void handle_sched_waking(void *data, /* XXX: fill header */) { da_handle_event_wip(sched_waking_wip); } static int enable_wip(void) { int retval; retval = da_monitor_init_wip(); if (retval) return retval; rv_attach_trace_probe("wip", /* XXX: tracepoint */, handle_preempt_disable); rv_attach_trace_probe("wip", /* XXX: tracepoint */, handle_preempt_enable); rv_attach_trace_probe("wip", /* XXX: tracepoint */, handle_sched_waking); return 0; }”…””}”hh×sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hÕhŸh¶h K hh£hžhubh¸)”}”(hŒ‘The comment at the top of the section explains the general idea: the instrumentation section translates *kernel events* into the *model's event*.”h]”(hŒhThe comment at the top of the section explains the general idea: the instrumentation section translates ”…””}”(hhçhžhhŸNh NubhŒemphasis”“”)”}”(hŒ*kernel events*”h]”hŒ kernel events”…””}”(hhñhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hïhhçubhŒ into the ”…””}”(hhçhžhhŸNh Nubhð)”}”(hŒ*model's event*”h]”hŒmodel’s event”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hïhhçubhŒ.”…””}”(hhçhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K.hh£hžhubh¢)”}”(hhh]”(h§)”}”(hŒTracing callback functions”h]”hŒTracing callback functions”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hjhžhhŸh¶h K3ubh¸)”}”(hŒÙThe first three functions are the starting point of the callback *handler functions* for each of the three events from the wip model. The developer does not necessarily need to use them: they are just starting points.”h]”(hŒAThe first three functions are the starting point of the callback ”…””}”(hj,hžhhŸNh Nubhð)”}”(hŒ*handler functions*”h]”hŒhandler functions”…””}”(hj4hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hïhj,ubhŒ… for each of the three events from the wip model. The developer does not necessarily need to use them: they are just starting points.”…””}”(hj,hžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K5hjhžhubh¸)”}”(hŒUsing the example of::”h]”hŒUsing the example of:”…””}”(hjLhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K9hjhžhubhÖ)”}”(hŒtvoid handle_preempt_disable(void *data, /* XXX: fill header */) { da_handle_event_wip(preempt_disable_wip); }”h]”hŒtvoid handle_preempt_disable(void *data, /* XXX: fill header */) { da_handle_event_wip(preempt_disable_wip); }”…””}”hjZsbah}”(h]”h ]”h"]”h$]”h&]”håhæuh1hÕhŸh¶h K;hjhžhubh¸)”}”(hŒÈThe preempt_disable event from the model connects directly to the preemptirq:preempt_disable. The preemptirq:preempt_disable event has the following signature, from include/trace/events/preemptirq.h::”h]”hŒÇThe preempt_disable event from the model connects directly to the preemptirq:preempt_disable. The preemptirq:preempt_disable event has the following signature, from include/trace/events/preemptirq.h:”…””}”(hjhhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K@hjhžhubhÖ)”}”(hŒ3TP_PROTO(unsigned long ip, unsigned long parent_ip)”h]”hŒ3TP_PROTO(unsigned long ip, unsigned long parent_ip)”…””}”hjvsbah}”(h]”h ]”h"]”h$]”h&]”håhæuh1hÕhŸh¶h KDhjhžhubh¸)”}”(hŒ=Hence, the handle_preempt_disable() function will look like::”h]”hŒ