tldm-universe/Ardent/UV/gcidir/include/perfdata.h
2024-09-09 17:51:08 -04:00

115 lines
4.2 KiB
C
Executable File

#ifndef h_perfdata
#define h_perfdata
/****************************************************************************
*
* perfdata.h - UniVerse Performance Data
*
* Module %M% Version %I% Date %H%
*
* (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved
* This is unpublished proprietary source code of Ardent Software Inc.
* The copyright notice above does not evidence any actual or intended
* publication of such source code.
*
*******************************************************************************
*
* Maintenence log - insert most recent change descriptions at top
*
* Date.... GTAR# WHO Description.........................................
* 10/14/98 23801 SAP Change copyrights.
* 04/25/97 20510 AGM Module created
*
******************************************************************************/
/******************************************************************************
*
* Any change to this file should also be reflected in:
*
* WINNT/uvntperf.h
* WINNT/uvntperf.ini
* WINNT/uvntperf.c
*
******************************************************************************/
/*
* This file contains the definition of the perfromance data that
* UniVerse can maintain if the UV_PERFORMANCE_DATA token is defined
* in hardwareh.smp
*
* The structure that contains the actual data is added to the end of
* the main disk shared memory segment when the token is defined and
* various sections of the code set the counts as things change.
*
* Any UniVerse process can change the data in this structure. There is
* no special semaphore used to maintain the integrity of the data
* (I.e. prevent mutiple processes accessing it at the same time). This is
* because we do not want to effect the performance of UniVerse by
* requiring that semaphores be obtained in order to update the data.
*
* Instead of a performance semaphore we rely on the fact that some
* other UniVerse concurrency semaphore will be held when the performance
* data is changed. For example, data relating to the group locks will
* only be changed when the group lock semaphore is held. The exception
* to this is the user defined data items where there will be no concurency
* control at all. BASIC programs should implement this themselves if they
* want it.
*
* No concurrency control is used when reading this data. Each item is
* a 'snapshot' at the point at which it is read and no consistency
* bewteen values is guaranteed.
*/
#ifdef UV_PERFORMANCE_DATA
/*
* This structure defines most of the items items that make up the
* performance data. It may not be possible to gather/maintain all
* of these items on all systems. Additional data is extracted from
* other items in the main shared memory segment (E.g. log file size)
*/
#define UVPERF_N_USER_CTRS 5
typedef struct
{
int nProcesses; /* Total UV processes (parents+children+ etc) */
int nLeaders; /* Number of parent UV processes */
int t30usedSlots; /* Number of t30table slots used */
int t30refsTotal; /* Total number of opens on T30s (refs) */
int t30splits; /* Number of splits on T30 files */
int t30merges; /* Number of merges on T30 files */
struct Dstats fileStats; /* From DBFILE.h - file statistics */
int userCounter[UVPERF_N_USER_CTRS]; /* Set from BASIC progs */
} PERF_DATA;
/*
* These macros should be used to increment/decrement/set the
* various performance counters. For the time being there is no
* concurrency control here... we are changing shared memory without
* taking any special lock. This is considered ok for the time
* being as the performance data is not critical... it does not
* matter if it is incorrect! Should it be deemed necessary to
* ensure the accuracy (at a penalty of overall system performance)
* then these macros should be modified to use atmoic operations
* or take a 'performance monitor' semaphore.
*/
#define INC_PERF_CTR(X) ((DBshmseg->perfdata.X)++)
#define DEC_PERF_CTR(X) ((DBshmseg->perfdata.X)--)
#define SET_PERF_CTR(X, Y) (DBshmseg->perfdata.X = Y)
#else
/* No performance instrumentation... */
#define INC_PERF_CTR(X)
#define DEC_PERF_CTR(X)
#define SET_PERF_CTR(X, Y)
#endif
#endif
/* End of Module */