Debugging techniques for SilkPerformer


Use the following information to know about some debugging techniques you can try when using SilkPerformer:

Using print statements for debugging

Using print statements helps you see the values in variables. For example, use the following function to print to the Virtual User tab of the SilkPerformer monitor window. This displays print statements in red so they are easy to see, and only when TryScript is used. During workload simulation, this function does not print unless you choose to view output from a specific virtual user.

print("Total SR:"+ string(gnSRTotal),OPT_DISPLAY_ALL, TEXT_RED);

Using write-to-file for debugging

Another way to debug is to write to a file for each user. This is useful if you want to know the values all users are using. In your header file, add a global Boolean variable that is set to true:

gbDebug : boolean init true;

Then, write a function that writes your input to a file, and put the function in the header file. For example:

function fDebug(sText:string(50000))
var
nUserId, hFile : number;
sOutput: string(55000);
begin
if(gbDebug) then
nUserId := GetUserId();
FOpen(hFile, "c:\\Logs\\User"+string(nUserId)+".txt",
OPT_FILE_ACCESS_READWRITE, OPT_FILE_OPENCREATE);
sOutput := sText \+"\r\n";
FWrite(hFile, sOutput, Strlen(sOutput), OPT_FILE_APPEND);
FClose(hFile);
end;
end fDebug;

Use this fDebug function where you normally put a print statement. Enable or disable it by using the global Boolean variable.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*