IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Inline CPU timer


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Jun 08, 2012 3:32 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Need help on DB2 compound SQL or Inli... DB2 3
No new posts in-stream data set (inline data set) ... JCL & VSAM 4
No new posts Getting error - COBOL INLINE ERROR DI... CLIST & REXX 14
No new posts Inline Image copy with Reorg DB2 4
No new posts Inline image copy DB2 3
Search our Forums:

Back to Top