Vue library functions
Unlike programs written in C or in FORTRAN, or in a native language, scripts written in Vue do not have access to the subroutines provided by the AIX system libraries or any user libraries. However, Vue supports its own special internal library of functions useful for dynamic tracing programs.
- Tracing-specific functions
-
- get_function
- Returns the name of the function that encloses the current probe. When the get_function function is called from interval, systrace, BEGIN, and END clause, the function returns an empty string.
- timestamp
- Returns the current timestamp.
- diff_time
- Finds the difference between two time stamps in microseconds or milliseconds.
- Trace capture functions
-
- printf
- Formats and prints values of variables and expressions.
- trace
- Prints data without formatting.
- stktrace
- Formats and prints the stack trace.
- List functions
-
- list
- Instantiates a list variable.
- append
- Appends a new item to list.
- sum, max, min, avg, count
- Aggregation functions that can be applied to a list variable.
- C-library functions
-
- atoi, strstr
- Standard string functions.
- Functions to support tentative tracing
-
- start_tentative, end_tentative
- Indicators for start and end of tentative tracing.
- commit_tentative, discard_tentative
- Commits or discards tentative trace data.
- Miscellaneous functions
-
- exit
- Terminates the Vue script.
- get_userstring
- Reads string (or data) from user memory.
- ptree
- Prints the process tree of the probed process.
You can apply the Vue string functions only on variables of string type and not on a pointer variable. Standard string functions like strcpy, strcat, and so on are not necessary in Vue, because they are supported through the language syntax itself.
The ProbeVue compiler validates the data types of the parameters passed to Vue functions.
For printf function, validation is done to check whether there is an argument supplied in the printf function for each format specifier given in the format string. The total number of format specifiers and the total number of arguments passed to the printf function should be equal. In addition to this, validation is also done to match whether the type of the argument passed is compatible with the actual type mentioned as format specifier in the format string. If these checks fail, the Probevue throws an error message.
printf(“hello world %s, %d\n”, str);
would throw
up an error message from the compiler as no argument is passed for %d. Similarly,
Printf(“The total count of elements is %d\n”, str);
also throws an
error message as the format specified is %d whereas the argument passed, str variable
is a string.Other Features Functions
printf (“The total count of elements is %lld\n”, i);
Where
i is a variable of type int, no error message is thrown because the variable i is a
compatible type for the format specifier requested. Hence, no exact type checking is done; however,
compatible type checking is. You cannot put functions in the predicate section of a Vue clause.