Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Inline CPU timer

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7251

PostPosted: Fri Jun 08, 2012 3:32 am    Post subject: Inline CPU timer
Reply with quote

With the usual provisos (don't use in production, don't rely on it being available after z/OS upgrade) here is a module which will make the CPU time available in the program which calls it (or wherever the storage happens to be defined).

At the "front" of a program,

CALL "BBPFTC1" USING ADDRESS OF a-doubleword-binary-defined-in-linkage

Then forget about the sub-program, no longer needed. You could, I suppose, even CANCEL it if you've loaded it dynamically.

When you need the CPU time, just use the field from Linkage. Typically, save it before a suspect block of code. Save it somewhere else after the block. Compare. To get the time "big enough", "divide by 4096" to get it to miliseconds.



Code:
       ID DIVISION.
       PROGRAM-ID. BBPFTC1.
                                                                     
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  W-PSA-POINTER                POINTER.
       LINKAGE SECTION.
       01  PSA-CONTROL-BLOCK.
           05  FILLER                   PIC X(548).
           05  PSA-CB-ASCB-POINTER      POINTER.
       01  ASCB-CONTROL-BLOCK.
           05  FILLER                   PIC X(64).
           05  ASCB-CB-CPUTIME          PIC X(8).
       01  L-CPU-TIME-PTR         USAGE POINTER.
       PROCEDURE DIVISION               USING L-CPU-TIME-PTR.
           SET W-PSA-POINTER            TO NULL
           SET ADDRESS OF PSA-CONTROL-BLOCK
                                        TO W-PSA-POINTER
           SET ADDRESS OF ASCB-CONTROL-BLOCK
                                        TO PSA-CB-ASCB-POINTER
           SET L-CPU-TIME-PTR           TO ADDRESS OF ASCB-CB-CPUTIME
           GOBACK
           .
Back to top
View user's profile Send private message

View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts in-stream data set (inline data set) ... Andi1982 JCL & VSAM 4 Thu Jul 07, 2016 2:59 pm
No new posts Getting error - COBOL INLINE ERROR DI... satish.sanagavarapu CLIST & REXX 14 Tue Sep 23, 2014 7:36 pm
No new posts Inline Image copy with Reorg gylbharat DB2 4 Fri Aug 09, 2013 12:31 am
No new posts Inline image copy vinodkumar_pallampati DB2 3 Thu Jun 30, 2011 1:25 pm
No new posts What is alternative for Inline Perform ? sambasivarao COBOL Programming 2 Fri Jul 03, 2009 12:56 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us