Fig. 1: An elevator control

By including fi_client.h, the following macros become available:

  • FITIN_MONITOR_VARIABLE(var)
    After the occurrence of this macro, FITIn will start looking for use-after-loads of var.
     
  • FITIN_MONITOR_MEMORY(mem, size)
    As in the previous case, but instead of giving a variable, one can specify the memory address mem and the original size size manually.
     
  • FITIN_UNMONITOR_VARIABLE(var)
    After the occurrence, FITIn will no longer count accesses to var.
     
  • FITIN_UNMONITOR_MEMORY(mem, size)
    After the occurrence, FITIn will no longer count accesses to mem.

Next, we take the original code, include the header file fi_client.h and place the annotation FITIN_MONITOR_ VARIABLE(state) right after the variable’s declaration in line 14; the resulting modified source code is shown in Fig. 2.
Once all variables of interest have been annotated, the program needs to be recompiled. It is strongly recommended to disable compiler-side optimizations so that the counted accesses at source-code level and internally are kept in sync.

Please note that these annotations only assist you in selecting the target. In your Lua control script, in the callback monitor_address, you can either respect or ignore the annotation. Thus, you do not necessarily need the annotation at all.


Fig.2: Annotation of the example