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     User written subroutine fails in WebFOCUS 7.7.03

Read-Only Read-Only Topic
Go
Search
Notify
Tools
User written subroutine fails in WebFOCUS 7.7.03
 Login/Join
 
Member
posted
Hi everybody,

I didn't find many posts on user written subroutines, and none regarding this problem.

I have been using the following subroutine on WebFocus 5.3 on W2k3. It's an elapsed timer to profile applications.

It is compiled with MS Visual Studio as a shared library and copied to \\dbserver\ibi\srv77\wfs\user directory.

elaptimr.def:

   LIBRARY      "ELAPTIMR"

   EXPORTS
       ; Explicit exports can go here
   elaptimr


elaptimr.c:

   #include <stdio.h>
   #include <stdlib.h>
   #include <time.h>
   #include <string.h>

   clock_t ct;

   void elaptimr(char *a)
   {
      clock_t elap = clock();
      sprintf(a,"%g",(double)(elap-ct)/1000.0);
      ct = elap;
   }


And used, e.g., as follows:

   -RUN
   -* Reset the ct variable
   -SET &ET = ELAPTIMR('                ');

   -* Do some processing ...

   -RUN
   -* Get the difference since reset
   -SET &ET = ELAPTIMR('                ');
   -TYPE Code block duration &ET seconds


On 5.3 the value in ct is persistent, and usually the number of milliseconds since the agent instantiated. The reset call sets the value of ct to the number of milliseconds at the start of the code block to be profiled. The second call should then return the elapsed time in decimal seconds.

On 7.7.03 the behavior acts like ct is no longer persistent and is reinitialized with each call to the subroutine. Any help, confirmation, advice will be appreciated.

Thanks, Steve F
 
Posts: 14 | Location: Texas | Registered: May 16, 2006Report This Post
Expert
posted Hide Post
5.3 to 7.7... whew, whiplash of a jump! good on ya!
there are some new option on the system variable &TOD in 7.7 that can reset the clock and let you grab durations of executions. Check those out.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Member
posted Hide Post
Thank you for replying.

Not so much of a jump, just that the last time I had to profile a code block was when we were running 5.3 and it worked then. Today I tried to profile on 77 and it fails.

I didn't know about SET DATETIME options. Glad you mentioned it.

I don't use &TOD because it doesn't provide millisecond resolution. While searching for the &TOD options I ran across a post titled "How to find total time taken to run a FEX", which included the following code:

-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


If that works, that will be my backup so I can complete my current work.

I would still like to have confirmation regarding the change in how user written subroutines are instantiated or how to change my function to behave consistent with 5.3.
 
Posts: 14 | Location: Texas | Registered: May 16, 2006Report This Post
Expert
posted Hide Post
go download the SUMMIT presentations
here is a page of ones you'll like
one inparticular MORE STUFF YOU CAN USE ON MONDAY...
here




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
<JG>
posted
quote:
compiled with MS Visual Studio
On W2k3.

Look at the root cause. Are you still on W2k3 or have you moved to 2008 server?

MS Visual Studio, Have you tried to recompile the source?
 
Report This Post
Virtuoso
posted Hide Post
It could also be that these routines used to be loaded once and stay resident in memory for the session, and that now they are unloaded after use. Just guessing here, but it could explain the reset of your ct variable.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Member
posted Hide Post
I did move to 2008 R2 and 7.7 is 64 bit. So, yes, I had to recompile for 64 bit.

I'm thinking the routines are re-loaded each time they are called. I haven't found any indication of this being changed from previous versions in the 'New Features', and haven't found any reference to an option setting where I can alter the behavior.

Hoping to hear something from the core guys on this ...?

Thanks JG and GamP. It helps to know I'm on track.
 
Posts: 14 | Location: Texas | Registered: May 16, 2006Report 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     User written subroutine fails in WebFOCUS 7.7.03

Copyright © 1996-2020 Information Builders