| | 255 | |
| | 256 | === Using function block analysis from the web interface === |
| | 257 | The usage of function block analysis is described in !!! TODO add ref.!!! |
| | 258 | |
| | 259 | === Defining function blocks with regular expressions === |
| | 260 | Function blocks can be filtered by the means of regular expressions. |
| | 261 | An interface function, called {{{ri:fb_regexp/1}} is provided and its parameters are the following: |
| | 262 | * {{{ {type, Type} }}} \\ |
| | 263 | {{{ Type = list | get_rel | cycle | draw }}} |
| | 264 | * {{{list}}} Prints out every function block which matches the |
| | 265 | basic regular expression. |
| | 266 | * {{{get_rel}}} Decides whether there is a connection between |
| | 267 | the two given function blocks. |
| | 268 | * {{{cycle}}} Checks for cycles in the dependencies between the |
| | 269 | given function block list. |
| | 270 | * {{{ draw }}} Prints out the entire graph or creates a subgraph |
| | 271 | drawing from the given function block list. Output file is |
| | 272 | {{{fb_relations.dot}}} or can be user defined with the ''dot'' |
| | 273 | key. |
| | 274 | |
| | 275 | * {{{ {regexp, Value} }}} \\ |
| | 276 | {{{ Value = File::string() | [RegExp::string()] }}} |
| | 277 | |
| | 278 | If this option (tuple) is not given, the program works with a basic |
| | 279 | regular expression. The basic rule: {{{<function block>/common/<service>/ebin}}} or |
| | 280 | {{{<function block>/common/<service>/lib/ebin}}}. \\ |
| | 281 | The regular expression saved for this: |
| | 282 | {{{ (/)[0-9a-zA-Z_./]+/common/[0-9a-zA-Z_.]+/(lib/)?(ebin)$ }}} |
| | 283 | |
| | 284 | |
| | 285 | * {{{ Value }}} - If the regular expression is given in a file |
| | 286 | then every single regexp has to be defined in a separate line and |
| | 287 | must follow the Perl syntax and semantics as the http://www.erlang.org/doc/man/re.html |
| | 288 | erlang module resembles so. However, the user can give the regular expressions in a list |
| | 289 | as well. If there is an error with a regular expression in the |
| | 290 | file or in the list, it prints out the regexp, the error |
| | 291 | specification, and the position. The most usual regexp is ".*" |
| | 292 | (the Perl syntax does not allow simply "*", because this symbols |
| | 293 | means possible unlimited repetition of characters declared before |
| | 294 | it, and there are no characters declared before it) |
| | 295 | |
| | 296 | Examples: |
| | 297 | * {{{ri:fb_regexp([{type, draw}, {dot, test.dot}]).}}} |
| | 298 | * {{{ri:fb_regexp([{type, list}, {regexp, "regexp"}]).}}} |
| | 299 | * {{{ri:fb_regexp([{type, list}, {regexp, "^/home/[a-z./]+}]).}}} |
| | 300 | |
| | 301 | |
| | 302 | === User defined function blocks === |
| | 303 | One can make his own function block in the following three ways: |
| | 304 | 1. Giving the exact modules (with their name) which should be in |
| | 305 | one function block. |
| | 306 | 2. Regular expressions covering the structure of the directories. |
| | 307 | 3. By regular expressions covering the structure of the directories |
| | 308 | and the structure of the name of the files. |
| | 309 | |
| | 310 | Example: |
| | 311 | {{{ refusr_fb_regexp:re([{type, list}, {fb, [[cycle1, cycle2],"/home/user/[a-zA-z]*", "/home/user/[a-zA-z./]*/.*_ui.erl"]}]). }}} |
| | 312 | |
| | 313 | |
| | 314 | '''Optimisations''' |
| | 315 | |
| | 316 | For efficiency and time improving reasons, the result of the queries |
| | 317 | are saved into {{{dets}}} tables for the further queries. |
| | 318 | |
| | 319 | |
| | 320 | The results of previous queries are saved into dets tables (in the {{{dep_files}}} directory). This means that if |
| | 321 | the same query is run, the execution time may decreases significantly. |
| | 322 | At first run, a digraph is built as in the previous version, only it |
| | 323 | is saved later.If there was a whole database dependency check, than the tool works from that dets |
| | 324 | table instead of building a new subgraph, which also improves time |
| | 325 | efficiency. Due to this, it is strongly advised that if one knows that |
| | 326 | a lot of different node queries will be done, a whole check should be |
| | 327 | run in the first place. |
| | 328 | The saves are available until the |
| | 329 | database is unchanged. At the moment the hash value of the database is |
| | 330 | changed, the existing dets tables are deleted. The deletion does not |
| | 331 | effect the ''.dot'' files, although it is significant to remember |
| | 332 | to save them somewhere else from the ''dep_files'' directory, |
| | 333 | because the next call for draw function will overwrite the |
| | 334 | corresponding ''.dot'' file. This could be prevented by using the |
| | 335 | feature, that the user can define his own dot file name and absolute |
| | 336 | path. |