1
0
Fork 0
arangodb/lib/Statistics/statistics.h

259 lines
9.0 KiB
C++

////////////////////////////////////////////////////////////////////////////////
/// @brief statistics basics
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2004-2012 triAGENS GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is triAGENS GmbH, Cologne, Germany
///
/// @author Dr. Frank Celler
/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#ifndef TRIAGENS_STATISTICS_STATISTICS_H
#define TRIAGENS_STATISTICS_STATISTICS_H 1
#include "BasicsC/common.h"
// -----------------------------------------------------------------------------
// --SECTION-- forward declarations
// -----------------------------------------------------------------------------
#ifdef __cplusplus
namespace triagens {
namespace basics {
class VariantArray;
}
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
// -----------------------------------------------------------------------------
// --SECTION-- public types
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup Statistics
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief request granularity
////////////////////////////////////////////////////////////////////////////////
enum TRI_statistics_granularity_e {
TRI_STATISTICS_SECONDS,
TRI_STATISTICS_MINUTES,
TRI_STATISTICS_HOURS,
TRI_STATISTICS_DAYS
};
////////////////////////////////////////////////////////////////////////////////
/// @brief statistics list entry
////////////////////////////////////////////////////////////////////////////////
typedef struct TRI_statistics_entry_s {
struct TRI_statistics_entry_s* _next;
}
TRI_statistics_entry_t;
////////////////////////////////////////////////////////////////////////////////
/// @brief list list
////////////////////////////////////////////////////////////////////////////////
typedef struct TRI_statistics_list_s {
TRI_statistics_entry_t* _first;
TRI_statistics_entry_t* _last;
}
TRI_statistics_list_t;
////////////////////////////////////////////////////////////////////////////////
/// @brief request statistics
////////////////////////////////////////////////////////////////////////////////
typedef struct TRI_request_statistics_s {
void* _next;
double _readStart;
double _readEnd;
double _queueStart;
double _queueEnd;
double _requestStart;
double _requestEnd;
double _writeStart;
double _writeEnd;
double _receivedBytes;
double _sentBytes;
bool _tooLarge;
bool _executeError;
}
TRI_request_statistics_t;
////////////////////////////////////////////////////////////////////////////////
/// @brief connection statistics
////////////////////////////////////////////////////////////////////////////////
typedef struct TRI_connection_statistics_s {
void* _next;
bool _http;
double _connStart;
double _connEnd;
bool _error;
}
TRI_connection_statistics_t;
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- public request statistics functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup Statistics
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief gets a new statistics block
////////////////////////////////////////////////////////////////////////////////
TRI_request_statistics_t* TRI_AcquireRequestStatistics (void);
////////////////////////////////////////////////////////////////////////////////
/// @brief releases a statistics block
////////////////////////////////////////////////////////////////////////////////
void TRI_ReleaseRequestStatistics (TRI_request_statistics_t*);
////////////////////////////////////////////////////////////////////////////////
/// @brief updates the request statistics
////////////////////////////////////////////////////////////////////////////////
void TRI_UpdateRequestStatistics (double now);
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- public connection statistics functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup Statistics
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief gets a new statistics block
////////////////////////////////////////////////////////////////////////////////
TRI_connection_statistics_t* TRI_AcquireConnectionStatistics (void);
////////////////////////////////////////////////////////////////////////////////
/// @brief releases a statistics block
////////////////////////////////////////////////////////////////////////////////
void TRI_ReleaseConnectionStatistics (TRI_connection_statistics_t*);
////////////////////////////////////////////////////////////////////////////////
/// @brief updates the connection statistics
////////////////////////////////////////////////////////////////////////////////
void TRI_UpdateConnectionStatistics (double now);
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup Statistics
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief returns a statistics list
////////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
triagens::basics::VariantArray*
TRI_StatisticsInfo (TRI_statistics_granularity_e granularity,
size_t limit,
bool showTotalTime,
bool showQueueTime,
bool showRequestTime,
bool showBytesSent,
bool showBytesReceived,
bool showHttp);
#endif
////////////////////////////////////////////////////////////////////////////////
/// @brief gets the current wallclock time
////////////////////////////////////////////////////////////////////////////////
double TRI_StatisticsTime (void);
////////////////////////////////////////////////////////////////////////////////
/// @brief fills a linked list
////////////////////////////////////////////////////////////////////////////////
void TRI_FillStatisticsList (TRI_statistics_list_t*, size_t element, size_t count);
////////////////////////////////////////////////////////////////////////////////
/// @brief module init function
////////////////////////////////////////////////////////////////////////////////
void TRI_InitialiseStatistics (void);
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
}
#endif
#endif
// -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE
// -----------------------------------------------------------------------------
// Local Variables:
// mode: outline-minor
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}\\)"
// End: