Files
mars-nwe/include/core/histogram.h
2026-06-13 19:53:38 +02:00

142 lines
3.8 KiB
C

/****************************************************************************
|
| (C) Copyright 1985, 1991, 1993, 1996 Novell, Inc.
| All Rights Reserved.
|
| This program is free software; you can redistribute it and/or
| modify it under the terms of version 2 of the GNU General Public
| License as published by the Free Software Foundation.
|
| This program is distributed in the hope that it will be useful,
| but WITHOUT ANY WARRANTY; without even the implied warranty of
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
| GNU General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with this program; if not, contact Novell, Inc.
|
| To contact Novell about this file by physical or electronic mail,
| you may find current contact information at www.novell.com
|
|***************************************************************************
|
| NetWare Advance File Services (NSS) module
|
|---------------------------------------------------------------------------
|
| $Author: vandana $
| $Date: 2007-04-18 23:26:20 +0530 (Wed, 18 Apr 2007) $
|
| $RCSfile$
| $Revision: 1954 $
|
|---------------------------------------------------------------------------
| This module is used to:
|
| WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
|
| This header file should ONLY be used for NSS internal development.
| This includes Semantic Agents (SA) and Loadable Storage Services (LSS).
| Any other use may cause conflicts which NSS will NOT fix.
+-------------------------------------------------------------------------*/
#ifndef _HISTOGRAM_H_
#define _HISTOGRAM_H_
#ifndef _OMNI_H_
#include <omni.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Pre-define struct(s) so Linux compiler doesn't complain */
struct ScreenStruct;
struct PCLSwitchDef_s;
typedef struct Histogram_s
{
NINT currentCount;
NINT highWaterMark;
QUAD eventSum;
NINT totalCount;
NINT bucket[BITS_PER_NINT];
} Histogram_s;
void incHistogram(Histogram_s *histogram);
void eventHistogram(Histogram_s *histogram, NINT event);
void prHistogram(
struct ScreenStruct *screenID,
NINT attribute,
Histogram_s *histogram);
STATUS registerHistogram(
char *name,
BOOL *isEnabled,
Histogram_s *histogram);
STATUS doDisplayHistogram(
struct PCLSwitchDef_s *switchDef,
NINT options,
void *userParm);
STATUS doDisableHistogram(
struct PCLSwitchDef_s *switchDef,
NINT options,
void *userParm);
STATUS doClearHistogram(
struct PCLSwitchDef_s *switchDef,
NINT options,
void *userParm);
STATUS doListHistograms(
struct PCLSwitchDef_s *switchDef,
NINT options,
void *userParm);
STATUS doEnableHistogram(
struct PCLSwitchDef_s *switchDef,
NINT options,
void *userParm);
#if HISTOGRAM IS_ENABLED
#define INC_HISTOGRAM(_hist) (incHistogram(&(_hist)))
#define DEC_HISTOGRAM(_hist) (--((_hist).currentCount))
#define ZERO_HISTOGRAM(_hist) (bzero(&(_hist), sizeof(Histogram_s)))
#define EVENT_HISTOGRAM(_hist, _event) (eventHistogram(&(_hist), (_event)))
#else
#define INC_HISTOGRAM(_hist) ((void)0)
#define DEC_HISTOGRAM(_hist) ((void)0)
#define ZERO_HISTOGRAM(_hist) ((void)0)
#define EVENT_HISTOGRAM(_hist, _event) ((void)0)
#endif
/*
* These are some macros for managing performance measurements of
* individual paths through the code. The macros come in match sets,
* START_TIMER/STOP_TIMER and SUSPEND_TIMER/RESUME_TIMER. Information
* between macros is passed in a shared structure on the stack. The
* reference to this structure is stored in a global variable, CurrentTimer.
* SUSPEND/RESUME save the global in the variable declared by SAVE_TIMER.
* They must both be in the same routine.
*/
typedef struct Timer_s
{
NINT start;
NINT running;
NINT suspended;
} Timer_s;
extern Timer_s *CurrentTimer;
#ifdef __cplusplus
}
#endif
#endif