Top

Name

msec_time — Get number of milliseconds from system epoch

Synopsis

msec_time ( void);  
 

Description

msec_time returns the number of milliseconds since system epoch. It is useful for benchmarking purposes, timing operations, etc.

Parameters

No parameters

The function does not take parameters.

Return Values

A 32-bit integer no. of milliseconds since system epoch.

Examples

Example 24.222. Simple example

Time a function

create procedure
fib (in n integer)
{
  if (n <= 2) return 1;
  return fib (n - 1) + fib (n - 2);
}
;

create procedure
time_fib (in n integer)
{
  declare t,i integer;
  declare msg varchar;

  result_names (msg);

  t := msec_time();
  i := fib (n);
  result (sprintf ('fib (%d) is %d, got it in %d milliseconds.',
	           n, i, msec_time() - t));
}
;

SQL> time_fib(10);
msg
VARCHAR NOT NULL
_______________________________________________________________________________

fib (10) is 55, got it in 10 milliseconds.

1 Rows. -- 21 msec.


See Also

now