[3605] | 1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
| 2 | /* |
---|
| 3 | * Copyright (C) 2004-2013 HUBzero Foundation, LLC |
---|
| 4 | * |
---|
| 5 | */ |
---|
| 6 | #ifndef NANOVIS_SERVER_H |
---|
| 7 | #define NANOVIS_SERVER_H |
---|
| 8 | |
---|
| 9 | #include <sys/types.h> // For pid_t |
---|
| 10 | #include <sys/time.h> // For struct timeval |
---|
| 11 | #include <cstddef> // For size_t |
---|
| 12 | #include <cstdio> // For FILE * |
---|
| 13 | |
---|
| 14 | #include <tcl.h> |
---|
| 15 | |
---|
| 16 | #include "config.h" |
---|
| 17 | |
---|
[4796] | 18 | #define NANOVIS_VERSION_STRING "1.2.0" |
---|
[3614] | 19 | |
---|
[3605] | 20 | #define MSECS_ELAPSED(t1, t2) \ |
---|
| 21 | ((t1).tv_sec == (t2).tv_sec ? (((t2).tv_usec - (t1).tv_usec)/1.0e+3) : \ |
---|
| 22 | (((t2).tv_sec - (t1).tv_sec))*1.0e+3 + (double)((t2).tv_usec - (t1).tv_usec)/1.0e+3) |
---|
| 23 | |
---|
| 24 | #define CVT2SECS(x) ((double)(x).tv_sec) + ((double)(x).tv_usec * 1.0e-6) |
---|
| 25 | |
---|
| 26 | namespace nv { |
---|
| 27 | class ReadBuffer; |
---|
| 28 | class ResponseQueue; |
---|
| 29 | |
---|
| 30 | typedef struct { |
---|
| 31 | pid_t pid; |
---|
| 32 | size_t nFrames; /**< # of frames sent to client. */ |
---|
| 33 | size_t nFrameBytes; /**< # of bytes for all frames. */ |
---|
| 34 | size_t nCommands; /**< # of commands executed */ |
---|
| 35 | double cmdTime; /**< Elasped time spend executing |
---|
| 36 | * commands. */ |
---|
| 37 | struct timeval start; /**< Start of elapsed time. */ |
---|
| 38 | } Stats; |
---|
| 39 | |
---|
| 40 | extern Stats g_stats; |
---|
| 41 | |
---|
| 42 | extern int g_statsFile; ///< Stats file descriptor |
---|
| 43 | extern int g_fdIn; ///< Input file descriptor |
---|
| 44 | extern int g_fdOut; ///< Output file descriptor |
---|
| 45 | extern FILE *g_fOut; ///< Output file handle |
---|
| 46 | extern FILE *g_fLog; ///< Trace logging file handle |
---|
| 47 | extern ReadBuffer *g_inBufPtr; ///< Socket read buffer |
---|
| 48 | #ifdef USE_THREADS |
---|
| 49 | extern ResponseQueue *g_queue; |
---|
| 50 | #endif |
---|
| 51 | |
---|
| 52 | #ifdef KEEPSTATS |
---|
[4794] | 53 | extern int getStatsFile(Tcl_Obj *objPtr); |
---|
[3605] | 54 | extern int writeToStatsFile(int f, const char *s, size_t length); |
---|
| 55 | #endif |
---|
[4063] | 56 | extern void sendDataToClient(const char *command, char *data, |
---|
[3605] | 57 | size_t dlen); |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | #endif |
---|