www.openlinksw.com
docs.openlinksw.com

Book Home

Contents
Preface

Virtuoso Functions Guide

Administration
db.dba.vacuum
user_change_password
user_create
user_drop
user_get_option
user_grant_role
user_revoke_role
user_role_create
user_role_drop
user_set_option
user_set_qualifier
cfg_item_count
cfg_item_name
cfg_item_value
cfg_section_count
cfg_section_name
cfg_write
checkpoint_interval
disconnect_user
fk_check_input_value...
key_estimate
log_enable
log_text
prof_enable
prof_sample
server_root
status
sys_lockdown
sys_stat
system
trace_status
user_set_password
virtuoso_ini_path
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
RDF data
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web Server & Internet
XML
XPATH & XQUERY

Functions Index

prof_sample

Adds a profiling sample to a profile being accumulated.
prof_sample (in desc varchar, in time_spent integer, in flag integer);
Description

prof_sample is used to adds a profiling sample to a profile being accumulated.

The first argument is the name of the sampled section, the times called and cumulative times will be totaled under this heading. The second argument is the time in milliseconds. The third argument is a flag indicating whether the section was successfully executed. 0 indicates success, 1 indicates execute of the statement, 2 indicates fetch on a statement's resultset, 4 indicates error. For more description of profiling capabilities see the section about SQL Execution Profiling in Performance tuning part of Virtuoso documentation.

Parameters
desc – A VARCHAR. Name of the sampled section.
time_spent – An INTEGER. Time in milliseconds.
flag – An INTEGER. flag indicating whether the section was successfully executed. 0 - success, 1 - execute of statement, 2 - fetch on a statement's resultset, 4 - error.
Return Types

None.

Example
create procedure do_prof_sample()
{
  declare stime integer;
  for(declare i integer;i < 5;i := i + 1){
    stime := msec_time();
    for(select * from Demo.demo.Customers) do sprintf('1');
    for(select * from Demo.demo.Employees) do sprintf('1');
    for(select * from Demo.demo.Order_Details) do sprintf('1');
    prof_sample('3 selects execute',msec_time() - stime,1);

  };

};

prof_enable(1);
select do_prof_sample();
prof_enable(0);

This will produce virtprof.out file of the sort:

Query Profile (msec)
Real 168, client wait 313, avg conc 1.863095 n_execs 6 avg exec  52

100 % under 1 s
0 % under 2 s
0 % under 5 s
0 % under 10 s
0 % under 30 s

2 stmts compiled 1 msec, 0 % prepared reused.

 %  total n-times n-errors
50 % 157      1        0     select do_prof_sample
49 % 156      5        0     3 selects execute
See Also

SQL Execution profiling.

prof_enable()