Autor Beitrag
FrankBKK
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29

Win XP
D5
BeitragVerfasst: Sa 01.11.08 06:47 
Ich wollte mal feststellen wie viel Zeit eine Routine
innerhalb einer Stored Proc. am Laufen ist.

Dabei ist mir aufgefallen dass in dem u.a. Beispiel
die Variable intTimeNeeded immer 0 ist - egal wie lange
die Routine laeuft.

Hab ich da was falsch gemacht oder wird der current_timestamp
Wert waehrend der Ausfuehrung einer SP nicht aktualisiert ?

Falls das so ist - wie kann ich die Laufzeit einer Proc. feststellen ?



ausblenden volle Höhe SQL-Anweisung
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
SET TERM  ^^ ;
CREATE PROCEDURE P_TEST returns (
  TIME_START TimeStamp,
  TIME_STOP TimeStamp,
  TIME_NEEDED Numeric(18,9))
AS
/*
  Procedure: P_TEST

  Author   : FRANK
  Date     : 01.11.2008
  Purpose  : Various Tests or Data-Updates / Patches
  ------
*/

declare variable intTimeStart                     TimeStamp  ;
declare variable intTimeStop                      TimeStamp  ;
declare variable intTimeNeeded                    numeric(18,9) default 0 ;

declare variable intDoSomething                   Char(31) default '' ;

begin

   /* initial value when starting */
   intTimeStart = current_TimeStamp ;

   /* do something here to waist time */
   for
      select RDB$FIELD_NAME from RDB$FIELDS into intDoSomething
   do
   begin
      for
         select RDB$FIELD_NAME from RDB$FIELDS into intDoSomething
      do
      begin
      end
   end

   /* time on finished */
   intTimeStop  = current_TimeStamp ;

   /* total time needed */
   intTimeNeeded= (intTimeStop - intTimeStart) * 24 * 60 ; /* minutes */

   /* results */
   TIME_START = intTimeStart ;
   TIME_STOP  = intTimeStop ;
   TIME_NEEDED= intTimeNeeded ;

end
 ^^
SET TERM ;  ^^
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mo 03.11.08 10:19 
porobier mal now. Ich hab da irgendwas im Kopf, dass now die wirkliche aktuelle Zeit ist und current_timestamp die Zeit ist, bei der das Query bzw die SP gestartet wurde.
Aber ich kann mich auch täuschen.

_________________
In the beginning was the word.
And the word was content-type: text/plain.
alex517
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 60


D7Ent, FB, FIBPlus
BeitragVerfasst: Mo 03.11.08 11:49 
sieh mal hier:
www.firebirdfaq.org/faq114/

alex
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mo 03.11.08 14:29 
wusst ichs doch :-)

_________________
In the beginning was the word.
And the word was content-type: text/plain.
FrankBKK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29

Win XP
D5
BeitragVerfasst: Mo 03.11.08 20:52 
Alles klar - Problem erkannt !

Vielen Dank fuer die prompte reply !