beautypg.com

D example of measurement application inc, D. example of measurement application in c, Example d-1 – HP NonStop G-Series User Manual

Page 187: Measurement application in c, Example of measurement application in c

background image

Measure User’s Guide 520560-003

D- 1

D

Example of Measurement
Application in C

When programming in C or C++, refer to the C declarations in files MEASCHMA and
MEASDECS to see whether a field is within a union. If the field is within a union,
include the union name when writing code that uses the field.

Existing C or C++ programs that use Measure data might not compile using the C
structure declarations in new PVUs of Measure’s MEASCHMA or MEASDECS.
References to fields that now are within a union must be changed to include the union
name in the reference.

Example D-1

shows a C program that uses the Measure callable procedures to

configure and run a measurement.

Example D-1. Measurement Application in C (page 1 of 4)

#include nolist
#include nolist
#include nolist
#include nolist
#include "measc" nolist /* Contains all MEASURE
declarations, derived
from MEASCHMA */
#include "cmeasddl" nolist /* contains record structure
declarations,
derived from MEASDDLS */
int main(int argc, char *argv[])
{
#define TRUE -1
#define FALSE 0
#define MAX_NUM_MEASUREMENTS 64

/* all the measure contab definitions */
typedef struct
{
contab_hdr_def Header;
cpu_desc_def EDesc;
contab_trailer_def Trailer;
} ContabForCPU;

typedef struct
{
short FName[12];
} MeasNamesDef;

ContabForCPU CPURec;
meascb_def MeasCB;
MeasNamesDef MeasNames[MAX_NUM_MEASUREMENTS];
cpu_def CpuData;