mirror of https://gitee.com/bigwinds/arangodb
177 lines
6.7 KiB
C
177 lines
6.7 KiB
C
////////////////////////////////////////////////////////////////////////////////
|
|
/// @brief collection of process functions
|
|
///
|
|
/// @file
|
|
///
|
|
/// DISCLAIMER
|
|
///
|
|
/// Copyright 2004-2013 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 Esteban Lombeyda
|
|
/// @author Copyright 2008-2013, triAGENS GmbH, Cologne, Germany
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#ifndef TRIAGENS_BASICS_C_PROCESS_UTILS_H
|
|
#define TRIAGENS_BASICS_C_PROCESS_UTILS_H 1
|
|
|
|
#include "BasicsC/common.h"
|
|
|
|
#include "BasicsC/threads.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// --SECTION-- public constants
|
|
// -----------------------------------------------------------------------------
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// @addtogroup SystemProcess
|
|
/// @{
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// @brief invalid process
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#define INVALID_PROCESS (0)
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// @}
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// --SECTION-- public types
|
|
// -----------------------------------------------------------------------------
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// @addtogroup SystemProcess
|
|
/// @{
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// @brief returns information about the process
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
typedef struct TRI_process_info_s {
|
|
uint64_t _minorPageFaults;
|
|
uint64_t _majorPageFaults;
|
|
uint64_t _userTime;
|
|
uint64_t _systemTime;
|
|
int64_t _numberThreads;
|
|
int64_t _residentSize;
|
|
uint64_t _virtualSize;
|
|
uint64_t _scClkTck;
|
|
}
|
|
TRI_process_info_t;
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// @}
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// --SECTION-- public functions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// @addtogroup SystemProcess
|
|
/// @{
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// @brief converts usec and sec into seconds
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#ifdef TRI_HAVE_GETRUSAGE
|
|
uint64_t TRI_MicrosecondsTv (struct timeval* tv);
|
|
#endif
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// @brief returns information about the current process
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
TRI_process_info_t TRI_ProcessInfoSelf (void);
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// @brief returns information about the process
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
TRI_process_info_t TRI_ProcessInfo (TRI_pid_t pid);
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// @brief returns the size of the current process
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
uint64_t TRI_ProcessSizeSelf (void);
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// @brief returns the size of the process given its pid
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
uint64_t TRI_ProcessSize (TRI_pid_t pid);
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// @brief sets the process name
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
void TRI_SetProcessTitle (char const* title);
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// @}
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// --SECTION-- MODULE
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// --SECTION-- public functions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// @addtogroup SystemProcess
|
|
/// @{
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// @brief initialises the process components
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
void TRI_InitialiseProcess (int argc, char* argv[]);
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// @brief shut downs the process components
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
void TRI_ShutdownProcess (void);
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// @}
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|
|
// Local Variables:
|
|
// mode: outline-minor
|
|
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}"
|
|
// End:
|