ibm-information-center/dist/eclipse/plugins/i5OS.ic.apis_5.4.0.1/p0zdmp.htm

324 lines
10 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
<title>Qp0zDump()--Dump Formatted Storage Trace Data</title>
<!-- Begin Header Records ========================================== -->
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<!-- Change History: -->
<!-- YYMMDD USERID Change description -->
<!-- Direct1 SCRIPT J converted by B2H R4.1 (346) (CMS) by V2KEA304 -->
<!-- at RCHVMW2 on 17 Feb 1999 at 11:05:09 -->
<!-- Edited by Kersten Feb 02 -->
<!-- This file has undergone html cleanup May 2002 by JET -->
<!-- End Header Records -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<!-- Java sync-link -->
<script type="text/javascript" language="Javascript" src="../rzahg/synch.js">
</script>
<a name="Top_Of_Page"></a>
<h2>Qp0zDump()--Dump Formatted Storage Trace Data</h2>
<div class="box" style="width: 60%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;qp0ztrc.h&gt;
void Qp0zDump(const char <em>*label</em>,
void <em>*area</em>,
int <em>len</em>);
</pre>
<br>
&nbsp;&nbsp;Service Program Name: QP0ZCPA<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Default Public Authority: *USE<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Threadsafe: Yes<br>
<!-- iddvc RMBR -->
<br>
</div>
<p>The <strong>Qp0zDump()</strong> function dumps the user storage specified by
<em>area</em> to the user trace. The user-provided storage is formatted for
viewing in hexadecimal representation for up to <em>len</em> number of bytes.
The formatted storage is labeled with the text string specified by <em>
label</em>.</p>
<p>If any input parameters are not valid, or an incorrect or error condition is
detected, the <strong>Qp0zDump()</strong> function returns immediately and no
error is indicated.</p>
<p>An application should not use the tracing function in performance critical
code. These functions are intended for debugging exception or error conditions.
The user trace is a permanent user space object named <em>
QP0Z&lt;jobnumber&gt;</em> in the QUSRSYS library. The user trace is created
the first time any thread in a job writes trace output. See the Change User
Trace (CHGUSRTRC), Dump User Trace (DMPUSRTRC) and Delete User Trace
(DLTUSRTRC) CL commands for information about manipulating the user trace
properties and objects.</p>
<br>
<h3>Parameters</h3>
<dl>
<dt><strong>label</strong></dt>
<dd>(Input) A pointer to a string that is used to label the storage dump.<br>
<br>
</dd>
<dt><strong>area</strong></dt>
<dd>(Input) A pointer to storage area that is to be formatted and dumped to the
user trace.<br>
<br>
</dd>
<dt><strong>len</strong></dt>
<dd>(Input) The number of bytes of storage to be formatted in the user
trace.</dd>
</dl>
<br>
<h3>Authorities</h3>
<p>None.</p>
<br>
<h3>Return Value</h3>
<p>None.</p>
<br>
<h3>Error Conditions</h3>
<p>If <strong>Qp0zDump()</strong> is not successful, the function returns
immediately and no error is indicated.</p>
<br>
<h3>Usage Notes</h3>
<ol>
<li>No locks are held on the user trace between calls to the tracing functions.
The user trace can be deleted while in use. The next function that produces
trace output will create the user trace again.<br>
<br>
</li>
<li>If another job on the system has the same job number as an existing user
trace, the existing trace data is cleared, and the trace data from the new job
replaces it.<br>
<br>
</li>
<li>As the format of the user trace records can change, only the following CL
commands can be used to manipulate the user trace properties and objects:<br>
<br>
<ul>
<li>Change User Trace (CHGUSRTRC) can be used to change the characteristics of
the user trace.<br>
<br>
</li>
<li>Dump User Trace (DMPUSRTRC) can be used to dump trace records to a file or
to standard output.<br>
<br>
</li>
<li>Delete User Trace (DLTUSRTRC) can be used to delete the user trace
objects.</li>
</ul>
</li>
</ol>
<br>
<h3>Related Information</h3>
<ul>
<li><a href="p0zdmps.htm">Qp0zDumpStack()</a>--Dump Formatted Stack Trace
Data<br>
<br>
</li>
<li><a href="p0zdmpt.htm">Qp0zDumpTargetStack()</a>--Dump Formatted Stack Trace
Data of the Target Thread<br>
<br>
</li>
<li><a href="p0zlog.htm">Qp0zLprintf()</a>--Print Formatted Job Log Data<br>
<br>
</li>
<li><a href="p0zprnt.htm">Qp0zUprintf()</a>--Print Formatted User Trace
Data</li>
</ul>
<br>
<h3>Example</h3>
<p>See <a href="../apiref/aboutapis.htm#codedisclaimer">Code disclaimer information</a>
for information pertaining to code examples.</p>
<p>The following example uses <strong>Qp0zDump()</strong> and <strong>
Qp0zUprintf()</strong> functions to produce trace output.</p>
<pre>
#define _MULTI_THREADED
#include &lt;pthread.h&gt;
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;unistd.h&gt;
#include &lt;qp0ztrc.h&gt;
#define THREADDATAMAX 128
void *theThread(void *parm)
{
char *myData = parm;
printf("Entered the %s thread\n", myData);
Qp0zUprintf("Tracing in the %s thread\n", myData);
Qp0zDump("The Data", myData, THREADDATAMAX);
free(myData);
return NULL;
}
int main(int argc, char **argv)
{
pthread_t thread, thread2;
int rc=0;
char *threadData;
printf("Enter Testcase - %s\n", argv[0]);
Qp0zUprintf("Tracing Testcase Entry\n");
printf("Create two threads\n");
Qp0zUprintf("Tracing creation of two threads\n");
threadData = (char *)malloc(THREADDATAMAX);
memset(threadData, 'Z', THREADDATAMAX);
sprintf(threadData, "50%% Cotton, 50%% Polyester");
rc = pthread_create(&amp;thread, NULL, theThread, threadData);
if (rc) {
printf("Failed to create a %s thread\n", threadData);
exit(EXIT_FAILURE);
}
threadData = (char *)malloc(THREADDATAMAX);
memset(threadData, 'Q', THREADDATAMAX);
sprintf(threadData, "Lacquered Camel Hair");
rc = pthread_create(&amp;thread2, NULL, theThread, threadData);
if (rc) {
printf("Failed to create a %s thread\n", threadData);
exit(EXIT_FAILURE);
}
printf("Wait for threads to complete\n");
rc = pthread_join(thread, NULL);
if (rc) { printf("Failed pthread_join() 1\n"); exit(EXIT_FAILURE); }
rc = pthread_join(thread2, NULL);
if (rc) { printf("Failed pthread_join() 2\n"); exit(EXIT_FAILURE); }
printf("Testcase complete\n");
Qp0zUprintf("Tracing completion of the testcase rc=%d\n", rc);
return 0;
}
</pre>
<br>
<h3>Trace Output:</h3>
<p>This trace output was generated after the test case was run by using the CL
command <strong>DMPUSRTRC JOB(100464/USER/TPZDUMP0) OUTPUT(*STDOUT)</strong>.
The above example program ran as job 100464/USER/TPZDUMP0.</p>
<p>Note the following in the trace output:</p>
<ol>
<li>Each trace record is indented by several spaces to aid in readability.
Trace records from different threads have different indentation levels.<br>
<br>
</li>
<li>Each trace record is identified by the hexadecimal thread ID, a colon, and
a timestamp. The timestamp can be used to aid in debugging of waiting or
looping threads. For example, the third trace record shown below (the Tracing
Testcase Entry trace point) was created by thread 0x13, and occurred 0.870960
seconds after the last full date and time label. This means that the trace
record was created on 5 January 1998 at 14:08:28.870960. A full date and time
label is placed between those trace points that occur during different whole
seconds.</li>
</ol>
<br>
<table border width="100%">
<tr>
<td><br>
<pre>
User Trace Dump for job 100464/USER/TPZDUMP0. Size: 300K, Wrapped 0
times. --- 01/05/1998 14:08:28 ---
00000013:870960 Tracing Testcase Entry
00000013:871720 Tracing creation of two threads
00000014:879904 Tracing in the 50% Cotton, 50% Polyester thread
00000014:880256 C66E80F4DF:001F60 L:0080 The Data
00000014:880968 C66E80F4DF:001F60 F5F06C40 C396A3A3 96956B40 F5F06C40 *50% Cotton, 50% *
00000014:881680 C66E80F4DF:001F70 D79693A8 85A2A385 9900E9E9 E9E9E9E9 *Polyester.ZZZZZZ*
00000014:882392 C66E80F4DF:001F80 E9E9E9E9 E9E9E9E9 E9E9E9E9 E9E9E9E9 *ZZZZZZZZZZZZZZZZ*
00000014:883096 C66E80F4DF:001F90 E9E9E9E9 E9E9E9E9 E9E9E9E9 E9E9E9E9 *ZZZZZZZZZZZZZZZZ*
00000014:883808 C66E80F4DF:001FA0 E9E9E9E9 E9E9E9E9 E9E9E9E9 E9E9E9E9 *ZZZZZZZZZZZZZZZZ*
00000014:884512 C66E80F4DF:001FB0 E9E9E9E9 E9E9E9E9 E9E9E9E9 E9E9E9E9 *ZZZZZZZZZZZZZZZZ*
00000014:885224 C66E80F4DF:001FC0 E9E9E9E9 E9E9E9E9 E9E9E9E9 E9E9E9E9 *ZZZZZZZZZZZZZZZZ*
00000015:887872 Tracing in the Lacquered Camel Hair thread
00000015:888216 C66E80F4DF:002000 L:0080 The Data
00000015:888952 C66E80F4DF:002000 D3818398 A4859985 8440C381 94859340 *Lacquered Camel *
00000015:889680 C66E80F4DF:002010 C8818999 00D8D8D8 D8D8D8D8 D8D8D8D8 *Hair.QQQQQQQQQQQ*
00000015:890416 C66E80F4DF:002020 D8D8D8D8 D8D8D8D8 D8D8D8D8 D8D8D8D8 *QQQQQQQQQQQQQQQQ*
00000015:891152 C66E80F4DF:002030 D8D8D8D8 D8D8D8D8 D8D8D8D8 D8D8D8D8 *QQQQQQQQQQQQQQQQ*
00000015:891888 C66E80F4DF:002040 D8D8D8D8 D8D8D8D8 D8D8D8D8 D8D8D8D8 *QQQQQQQQQQQQQQQQ*
00000015:892624 C66E80F4DF:002050 D8D8D8D8 D8D8D8D8 D8D8D8D8 D8D8D8D8 *QQQQQQQQQQQQQQQQ*
00000015:893352 C66E80F4DF:002060 D8D8D8D8 D8D8D8D8 D8D8D8D8 D8D8D8D8 *QQQQQQQQQQQQQQQQ*
00000015:894088 C66E80F4DF:002070 D8D8D8D8 D8D8D8D8 D8D8D8D8 D8D8D8D8 *QQQQQQQQQQQQQQQQ*
00000014:896168 C66E80F4DF:001FD0 E9E9E9E9 E9E9E9E9 E9E9E9E9 E9E9E9E9 *ZZZZZZZZZZZZZZZZ*
00000013:898832 Tracing completion of the testcase rc=0
Press ENTER to end terminal session.
</pre>
</td>
</tr>
</table>
<br>
<hr>
API introduced: V4R3
<hr>
<center>
<table cellpadding="2" cellspacing="2">
<tr align="center">
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href=
"unix.htm">UNIX-Type APIs</a> | <a href="aplist.htm">APIs by category</a></td>
</tr>
</table>
</center>
</body>
</html>