Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     How to find total time taken to run a FEX

Read-Only Read-Only Topic
Go
Search
Notify
Tools
How to find total time taken to run a FEX
 Login/Join
 
Gold member
posted
Hi,

How can we find out the total time taken to run a procedure?

Thank you.
 
Posts: 76 | Registered: October 28, 2003Report This Post
<Pietro De Santis>
posted
There are three system variables:

&FOCCPU Calculates the operating system CPU time in milliseconds.

&FOCTTIME Calculates total CPU time in milliseconds.

&FOCVTIME Calculates virtual CPU time in milliseconds.

Not sure what the differences between these are.

It's best to try them out.
 
Report This Post
<Pietro De Santis>
posted
It's more accurate if you do it yourself.

Put this at the top of the program:

-* Set Report Start Date and Time
-SET ST_DATE = &YYMD;
-SET ST_TIME = EDIT(HHMMSS('A8'),'99$99$99');

Put this at the bottom of the program:

-* Set Report End Date and Time
-SET &EN_DATE = &YYMD;
-SET &EN_TIME = EDIT(HHMMSS('A8'),'99$99$99');

-SET &ST_HH = EDIT(&ST_TIME,'99$$$$');
-SET &ST_MM = EDIT(&ST_TIME,'$$99$$');
-SET &ST_SS = EDIT(&ST_TIME,'$$$$99');

-SET &EN_HH = EDIT(&EN_TIME,'99$$$$');
-SET &EN_MM = EDIT(&EN_TIME,'$$99$$');
-SET &EN_SS = EDIT(&EN_TIME,'$$$$99');

-SET &EN_HH =
- IF &EN_DATE GT &ST_DATE THEN &EN_HH + 24 ELSE &EN_HH;

-SET &ST_TIME_S = (&ST_HH * 60 *60) + (&ST_MM * 60) + &ST_SS;
-SET &EN_TIME_S = (&EN_HH * 60 *60) + (&EN_MM * 60) + &EN_SS;

-SET &ELAPSED_S = &EN_TIME_S - &ST_TIME_S;
-SET &ELAPSED_M = &ELAPSED_S / 60;
-SET &ELAPSED_R = FMOD(&ELAPSED_S, 60, 'F2');

-TYPE
-TYPE Report elapsed time: &ELAPSED_M mins &ELAPSED_R secs

For convenience, put the two pieces of code into fexes that you -INCLUDE into your report program.
 
Report This Post
Gold member
posted Hide Post
Hi Pietro,

Second one works well. I do not think &variables are giving the right time. Thank you for the solution.

I have one more idea that works.

Include this at the beginning of the program
-SET &STARTIME = HHMMSS(STIME);
-TYPE &STARTIME

Include this at the end of the program
-SET &ENDTIME = HHMMSS(ETIME);
-TYPE &ENDTIME
 
Posts: 76 | Registered: October 28, 2003Report This Post
Member
posted Hide Post
How about this variation...

-SET &BEGTIME = HGETC(10,'HYYMDm');
-RUN

TABLE FILE ...
etc
etc


-SET &ENDTIME = HGETC(10,'HYYMDm');
-SET &SECS = HDIFF(&ENDTIME, &BEGTIME, 'SECOND', D12.2);
-SET &MILSEC = HDIFF(&ENDTIME, &BEGTIME, 'MILLISECOND', D12.2);
-TYPE Execution time in seconds = &SECS
-TYPE Execution time in mili-seconds = &MILSEC
-EXIT
 
Posts: 26 | Location: Mercy College | Registered: May 06, 2003Report This Post
Expert
posted Hide Post
so cool to know, kudos and thanks rb and tom.
I'd been using &tod and suffering.
This is great
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
<Pietro De Santis>
posted
Tom, thanks for your suggestion, nice and clean.
 
Report This Post
Gold member
posted Hide Post
Thank you Tom. It never stuck to me that we can DIFF functions for the difference.
 
Posts: 76 | Registered: October 28, 2003Report This Post
Member
posted Hide Post
I get a lot of date-time formatting tips from the presentation Renee Teatro gave in New Orleans titled, "That's not a date-time datatype, is it?". The link for the power point presentations is

http://www.informationbuilders.com/events/summit04/pres...Not_a_Date_TimeC.ppt
 
Posts: 26 | Location: Mercy College | Registered: May 06, 2003Report This Post
Gold member
posted Hide Post
A very good presentation. Thank you for the link!
 
Posts: 76 | Registered: October 28, 2003Report This Post
Platinum Member
posted Hide Post
I tried doing RB's suggestion:

Include this at the beginning of the program
-SET &STARTIME = HHMMSS(STIME);
-TYPE &STARTIME

Include this at the end of the program
-SET &ENDTIME = HHMMSS(ETIME);
-TYPE &ENDTIME

But it looks like it is not working. The start time is the same as the end time. I have a long report that when I time it using a stopwatch takes about 2 mins.

Am I missing something?

Thanks,
Dan


Dev: WebFOCUS 7.6.10, Data Migrator 7.6.10
QA: WebFOCUS 7.6.10, Data Migrator 7.6.10
Prod: WebFOCUS 7.6.2, Data Migrator 7.6.8
Windows 2K3, Tomcat 5.5.17, IIS 6
Usage: HTML, PDF, Excel, Self-serve, BID and MRE
 
Posts: 197 | Location: Roseville, CA | Registered: January 24, 2005Report This Post
Platinum Member
posted Hide Post
Possibly. Be sure you have a -RUN after the END statement of your TABLE FILE (and before the last -SET &ENDTIME). Otherwise, both the times will be captured before the report runs.


dwf
 
Posts: 135 | Location: Portland, OR | Registered: March 23, 2005Report This Post
Guru
posted Hide Post
You will need something like this:
-SET &STARTIME = HHMMSS(STIME);
-TYPE &STARTIME
-RUN

-* Replace LOOP with reporting code.
-SET &TOKEN = 0;
-REPEAT :LOOP FOR &INDX FROM 1 TO 10000 STEP 1;
-SET &TOKEN = &TOKEN + 1;
-:LOOP

-SET &ENDTIME = HHMMSS(ETIME);
-TYPE &ENDTIME
-RUN
 
Posts: 406 | Location: Canada | Registered: May 31, 2004Report This Post
Platinum Member
posted Hide Post
dwf & reFOCUSING,

My program is acting strange. Below is the code:

-SET &STARTIME = HHMMSS(STIME);
-TYPE &STARTIME
-RUN

TABLE FILE ONE
:
:
END
-RUN

-SET &ENDTIME = HHMMSS(ETIME);
-TYPE &ENDTIME
-RUN

Output:
1. With the above code, when I view the source, it ends at the end of the table file. I don't see ENDTIME at all.

2. But when I remove -RUN after the TABLE FILE, I can see ENDTIME but the value is the same as the STARTIME.


Dev: WebFOCUS 7.6.10, Data Migrator 7.6.10
QA: WebFOCUS 7.6.10, Data Migrator 7.6.10
Prod: WebFOCUS 7.6.2, Data Migrator 7.6.8
Windows 2K3, Tomcat 5.5.17, IIS 6
Usage: HTML, PDF, Excel, Self-serve, BID and MRE
 
Posts: 197 | Location: Roseville, CA | Registered: January 24, 2005Report This Post
Platinum Member
posted Hide Post
Ah. Just noticed. When using HHMMSS in Dialogue Manager, you need to specify the format in parenthesis, not the variable name.

-SET &STARTIME = HHMMSS('A8');
-TYPE &STARTIME
.
.
.
-SET &ENDTIME = HHMMSS('A8');
-TYPE &ENDTIME


Not sure how you even got a result before


dwf
 
Posts: 135 | Location: Portland, OR | Registered: March 23, 2005Report This Post
Platinum Member
posted Hide Post
dwf,

I'm now able to see the ENDTIME after I remove the -RUN command on the TABLE FILE before it. Thanks for all the help!

Dan


Dev: WebFOCUS 7.6.10, Data Migrator 7.6.10
QA: WebFOCUS 7.6.10, Data Migrator 7.6.10
Prod: WebFOCUS 7.6.2, Data Migrator 7.6.8
Windows 2K3, Tomcat 5.5.17, IIS 6
Usage: HTML, PDF, Excel, Self-serve, BID and MRE
 
Posts: 197 | Location: Roseville, CA | Registered: January 24, 2005Report This Post
Expert
posted Hide Post
Dan,

One of the bugbears that has always been commented upon is the fact that &TOD has always been set to the time at which the FOCUS session began. Over time this has become to be viewed as an asset because, combined with the HHMMSS function you can get that elapsed timing you require.

Taking advantage of the above facts, you can declare a function in your profile(s) that will then always be available -

-* Calculate seconds between final and initial time.
DEFINE FUNCTION ELAPSED(X/A1)
DAY/YYMD = HDATE(TODAY('A10'),'YYMD');
DATE/A6YMD = DAY;
BEGTIME/A8 = EDIT('&TOD.EVAL', '99$:99$:99');
ENDTIME/A8 = EDIT(HHMMSS('A8'), '99$:99$:99');
BEGAN/A20 = DATE | ' ' | BEGTIME;
ENDED/A20 = DATE | ' ' | ENDTIME;
-* Convert to time stamps
DATE_TIME1/HYYMDSA=HINPUT(20,BEGAN,10,'HYYMDS');
DATE_TIME2/HYYMDSA=HINPUT(20,ENDED,10,'HYYMDS');
-*Subtract the two time stamps, getting difference in seconds
ELAPSED/D12.2=HDIFF(DATE_TIME2, DATE_TIME1, 'SECOND', 'D12.2');
END
-RUN
-* The RUN is important to ensure that the define is actioned immediately and therefore available
-* when required.


Then when you want to access the elasped time, just set a variable to the function output value -

-* Find elapsed time
-SET &ELAPSED = ELAPSED('X');


This will cover all your elapsed timing needs (or should do?).

T

This message has been edited. Last edited by: Tony A,



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     How to find total time taken to run a FEX

Copyright © 1996-2020 Information Builders