1
0
Fork 0

moved files

This commit is contained in:
Jan Steemann 2015-08-19 11:19:37 +02:00
parent bc7e0f7bbd
commit 9f0384284f
104 changed files with 459 additions and 344 deletions

View File

@ -26,7 +26,6 @@ project(arangodb)
set(LIB_ARANGO arango)
set(LIB_ARANGO_CLIENT arango_client)
set(LIB_ARANGO_FE arango_fe)
set(LIB_ARANGO_V8 arango_v8)
set(BIN_ARANGOB arangob)

View File

@ -161,7 +161,6 @@ LIBS = \
noinst_LIBRARIES = \
lib/libarango.a \
lib/libarango_v8.a \
lib/libarango_fe.a \
lib/libarango_client.a \
arangod/libarangod.a

View File

@ -57,6 +57,16 @@ add_executable(
${ProductVersionFiles}
Actions/actions.cpp
Actions/RestActionHandler.cpp
Admin/ApplicationAdminServer.cpp
Admin/RestAdminBaseHandler.cpp
Admin/RestAdminLogHandler.cpp
Admin/RestBaseHandler.cpp
Admin/RestDebugHelperHandler.cpp
Admin/RestJobHandler.cpp
Admin/RestShutdownHandler.cpp
Admin/RestVersionHandler.cpp
ApplicationServer/ApplicationFeature.cpp
ApplicationServer/ApplicationServer.cpp
Aql/AggregationOptions.cpp
Aql/AqlItemBlock.cpp
Aql/AqlItemBlockManager.cpp
@ -105,6 +115,12 @@ add_executable(
Cluster/ServerJob.cpp
Cluster/ServerState.cpp
Cluster/v8-cluster.cpp
Dispatcher/ApplicationDispatcher.cpp
Dispatcher/Dispatcher.cpp
Dispatcher/DispatcherQueue.cpp
Dispatcher/DispatcherThread.cpp
Dispatcher/Job.cpp
Dispatcher/RequeueTask.cpp
FulltextIndex/fulltext-handles.cpp
FulltextIndex/fulltext-index.cpp
FulltextIndex/fulltext-list.cpp
@ -114,6 +130,17 @@ add_executable(
GeoIndex/GeoIndex.cpp
HashIndex/hash-array.cpp
HashIndex/hash-array-multi.cpp
HttpServer/ApplicationEndpointServer.cpp
HttpServer/AsyncJobManager.cpp
HttpServer/HttpCommTask.cpp
HttpServer/HttpHandler.cpp
HttpServer/HttpHandlerFactory.cpp
HttpServer/HttpListenTask.cpp
HttpServer/HttpServer.cpp
HttpServer/HttpServerJob.cpp
HttpServer/HttpsCommTask.cpp
HttpServer/HttpsServer.cpp
HttpServer/PathHandler.cpp
Indexes/CapConstraint.cpp
Indexes/EdgeIndex.cpp
Indexes/FulltextIndex.cpp
@ -126,6 +153,8 @@ add_executable(
Replication/ContinuousSyncer.cpp
Replication/InitialSyncer.cpp
Replication/Syncer.cpp
Rest/AnyServer.cpp
Rest/Handler.cpp
RestHandler/RestBatchHandler.cpp
RestHandler/RestCursorHandler.cpp
RestHandler/RestDocumentHandler.cpp
@ -144,7 +173,19 @@ add_executable(
RestServer/ConsoleThread.cpp
RestServer/VocbaseContext.cpp
RestServer/arangod.cpp
Scheduler/ApplicationScheduler.cpp
Scheduler/ListenTask.cpp
Scheduler/PeriodicTask.cpp
Scheduler/Scheduler.cpp
Scheduler/SchedulerLibev.cpp
Scheduler/SchedulerThread.cpp
Scheduler/SignalTask.cpp
Scheduler/SocketTask.cpp
Scheduler/Task.cpp
Scheduler/TaskManager.cpp
Scheduler/TimerTask.cpp
SkipLists/skiplistIndex.cpp
Statistics/statistics.cpp
Utils/CollectionExport.cpp
Utils/Cursor.cpp
Utils/CursorRepository.cpp

View File

@ -15,6 +15,16 @@ arangod_libarangod_a_CPPFLAGS = \
arangod_libarangod_a_SOURCES = \
arangod/Actions/actions.cpp \
arangod/Actions/RestActionHandler.cpp \
arangod/Admin/ApplicationAdminServer.cpp \
arangod/Admin/RestAdminBaseHandler.cpp \
arangod/Admin/RestAdminLogHandler.cpp \
arangod/Admin/RestBaseHandler.cpp \
arangod/Admin/RestDebugHelperHandler.cpp \
arangod/Admin/RestJobHandler.cpp \
arangod/Admin/RestShutdownHandler.cpp \
arangod/Admin/RestVersionHandler.cpp \
arangod/ApplicationServer/ApplicationFeature.cpp \
arangod/ApplicationServer/ApplicationServer.cpp \
arangod/Aql/AggregationOptions.cpp \
arangod/Aql/AqlItemBlock.cpp \
arangod/Aql/AqlItemBlockManager.cpp \
@ -63,6 +73,12 @@ arangod_libarangod_a_SOURCES = \
arangod/Cluster/ServerState.cpp \
arangod/Cluster/v8-cluster.cpp \
arangod/Cluster/ClusterMethods.cpp \
arangod/Dispatcher/ApplicationDispatcher.cpp \
arangod/Dispatcher/Dispatcher.cpp \
arangod/Dispatcher/DispatcherQueue.cpp \
arangod/Dispatcher/DispatcherThread.cpp \
arangod/Dispatcher/Job.cpp \
arangod/Dispatcher/RequeueTask.cpp \
arangod/FulltextIndex/fulltext-handles.cpp \
arangod/FulltextIndex/fulltext-index.cpp \
arangod/FulltextIndex/fulltext-list.cpp \
@ -72,6 +88,17 @@ arangod_libarangod_a_SOURCES = \
arangod/GeoIndex/GeoIndex.cpp \
arangod/HashIndex/hash-array.cpp \
arangod/HashIndex/hash-array-multi.cpp \
arangod/HttpServer/ApplicationEndpointServer.cpp \
arangod/HttpServer/AsyncJobManager.cpp \
arangod/HttpServer/HttpCommTask.cpp \
arangod/HttpServer/HttpHandler.cpp \
arangod/HttpServer/HttpHandlerFactory.cpp \
arangod/HttpServer/HttpListenTask.cpp \
arangod/HttpServer/HttpServer.cpp \
arangod/HttpServer/HttpServerJob.cpp \
arangod/HttpServer/HttpsCommTask.cpp \
arangod/HttpServer/HttpsServer.cpp \
arangod/HttpServer/PathHandler.cpp \
arangod/Indexes/CapConstraint.cpp \
arangod/Indexes/EdgeIndex.cpp \
arangod/Indexes/FulltextIndex.cpp \
@ -84,6 +111,8 @@ arangod_libarangod_a_SOURCES = \
arangod/Replication/ContinuousSyncer.cpp \
arangod/Replication/InitialSyncer.cpp \
arangod/Replication/Syncer.cpp \
arangod/Rest/AnyServer.cpp \
arangod/Rest/Handler.cpp \
arangod/RestHandler/RestBatchHandler.cpp \
arangod/RestHandler/RestCursorHandler.cpp \
arangod/RestHandler/RestDocumentHandler.cpp \
@ -102,7 +131,19 @@ arangod_libarangod_a_SOURCES = \
arangod/RestServer/ConsoleThread.cpp \
arangod/RestServer/VocbaseContext.cpp \
arangod/RestServer/arangod.cpp \
arangod/Scheduler/ApplicationScheduler.cpp \
arangod/Scheduler/ListenTask.cpp \
arangod/Scheduler/PeriodicTask.cpp \
arangod/Scheduler/Scheduler.cpp \
arangod/Scheduler/SchedulerLibev.cpp \
arangod/Scheduler/SchedulerThread.cpp \
arangod/Scheduler/SignalTask.cpp \
arangod/Scheduler/SocketTask.cpp \
arangod/Scheduler/Task.cpp \
arangod/Scheduler/TaskManager.cpp \
arangod/Scheduler/TimerTask.cpp \
arangod/SkipLists/skiplistIndex.cpp \
arangod/Statistics/statistics.cpp \
arangod/Utils/CollectionExport.cpp \
arangod/Utils/Cursor.cpp \
arangod/Utils/CursorRepository.cpp \

View File

@ -31,11 +31,9 @@
#define ARANGODB_REST_HANDLER_H 1
#include "Basics/Common.h"
#include "Statistics/StatisticsAgent.h"
#include "Basics/Exceptions.h"
#include "Dispatcher/Job.h"
#include "Statistics/StatisticsAgent.h"
// -----------------------------------------------------------------------------
// --SECTION-- forward declarations

View File

@ -30,13 +30,13 @@
#include <iostream>
#include "Basics/Common.h"
#include "Basics/messages.h"
#include "Basics/logging.h"
#include "Basics/tri-strings.h"
#include "Rest/InitialiseRest.h"
#include "Basics/files.h"
#include "Basics/logging.h"
#include "Basics/messages.h"
//#include "Basics/tri-strings.h"
#include "Rest/InitialiseRest.h"
#include "RestServer/ArangoServer.h"
#include "Statistics/statistics.h"
#include <signal.h>
using namespace triagens;
@ -110,6 +110,8 @@ int main (int argc, char* argv[]) {
// initialise sub-systems
TRI_GlobalEntryFunction();
TRIAGENS_REST_INITIALISE(argc, argv);
TRI_InitialiseStatistics();
if (startAsService) {
TRI_StartService(argc, argv);
@ -133,6 +135,8 @@ int main (int argc, char* argv[]) {
}
ArangoInstance = nullptr;
}
TRI_ShutdownStatistics();
// shutdown sub-systems
TRIAGENS_REST_SHUTDOWN;

View File

@ -334,67 +334,6 @@ static TRI_thread_t StatisticsThread;
// --SECTION-- private functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief gets the physical memory
////////////////////////////////////////////////////////////////////////////////
#if (defined(BSD) || defined(TRI_HAVE_MACOS_MEM_STATS))
static uint64_t GetPhysicalMemory () {
int mib[2];
int64_t physicalMemory;
size_t length;
// Get the Physical memory size
mib[0] = CTL_HW;
#ifdef TRI_HAVE_MACOS_MEM_STATS
mib[1] = HW_MEMSIZE;
#else
mib[1] = HW_PHYSMEM; // The bytes of physical memory. (kenel + user space)
#endif
length = sizeof(int64_t);
sysctl(mib, 2, &physicalMemory, &length, nullptr, 0);
return (uint64_t) physicalMemory;
}
#else
#ifdef TRI_HAVE_SC_PHYS_PAGES
static uint64_t GetPhysicalMemory () {
long pages = sysconf(_SC_PHYS_PAGES);
long page_size = sysconf(_SC_PAGE_SIZE);
return (uint64_t)(pages * page_size);
}
#else
#ifdef TRI_HAVE_WIN32_GLOBAL_MEMORY_STATUS
static uint64_t GetPhysicalMemory () {
MEMORYSTATUSEX status;
status.dwLength = sizeof(status);
GlobalMemoryStatusEx(&status);
return (uint64_t) status.ullTotalPhys;
}
#else
static uint64_t TRI_GetPhysicalMemory () {
PROCESS_MEMORY_COUNTERS pmc;
memset(&result, 0, sizeof(result));
pmc.cb = sizeof(PROCESS_MEMORY_COUNTERS);
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms684874(v=vs.85).aspx
if (GetProcessMemoryInfo(GetCurrentProcess(), &pmc, pmc.cb)) {
return pmc.PeakWorkingSetSize;
}
return 0;
}
#endif
#endif
#endif
////////////////////////////////////////////////////////////////////////////////
/// @brief checks for new statistics and process them
////////////////////////////////////////////////////////////////////////////////
@ -550,12 +489,6 @@ StatisticsDistribution* TRI_BytesReceivedDistributionStatistics;
TRI_server_statistics_t TRI_ServerStatistics;
////////////////////////////////////////////////////////////////////////////////
/// @brief physical memory
////////////////////////////////////////////////////////////////////////////////
uint64_t TRI_PhysicalMemory;
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
@ -578,7 +511,6 @@ double TRI_StatisticsTime () {
void TRI_InitialiseStatistics () {
TRI_ServerStatistics._startTime = TRI_microtime();
TRI_PhysicalMemory = GetPhysicalMemory();
// .............................................................................
// sets up the statistics

View File

@ -308,12 +308,6 @@ extern triagens::basics::StatisticsDistribution* TRI_BytesReceivedDistributionSt
extern TRI_server_statistics_t TRI_ServerStatistics;
////////////////////////////////////////////////////////////////////////////////
/// @brief physical memory
////////////////////////////////////////////////////////////////////////////////
extern uint64_t TRI_PhysicalMemory;
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------

View File

@ -0,0 +1,225 @@
////////////////////////////////////////////////////////////////////////////////
/// @brief V8 statistics functions
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2014 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 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 ArangoDB GmbH, Cologne, Germany
///
/// @author Dr. Frank Celler
/// @author Copyright 2014, ArangoDB GmbH, Cologne, Germany
/// @author Copyright 2011-2014, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include "v8-statistics.h"
#include "Basics/StringUtils.h"
#include "Statistics/statistics.h"
#include "V8/v8-conv.h"
#include "V8/v8-globals.h"
using namespace std;
using namespace triagens::arango;
using namespace triagens::basics;
using namespace triagens::httpclient;
using namespace triagens::rest;
////////////////////////////////////////////////////////////////////////////////
/// @brief creates a distribution vector
////////////////////////////////////////////////////////////////////////////////
static v8::Handle<v8::Array> DistributionList (v8::Isolate* isolate,
StatisticsVector const& dist) {
v8::EscapableHandleScope scope(isolate);
v8::Handle<v8::Array> result = v8::Array::New(isolate);
for (uint32_t i = 0; i < (uint32_t) dist._value.size(); ++i) {
result->Set(i, v8::Number::New(isolate, dist._value[i]));
}
return scope.Escape<v8::Array>(result);
}
////////////////////////////////////////////////////////////////////////////////
/// @brief fills the distribution
////////////////////////////////////////////////////////////////////////////////
static void FillDistribution (v8::Isolate* isolate,
v8::Handle<v8::Object> list,
v8::Handle<v8::String> name,
StatisticsDistribution const& dist) {
v8::Handle<v8::Object> result = v8::Object::New(isolate);
result->Set(TRI_V8_ASCII_STRING("sum"), v8::Number::New(isolate, dist._total));
result->Set(TRI_V8_ASCII_STRING("count"), v8::Number::New(isolate, (double) dist._count));
v8::Handle<v8::Array> counts = v8::Array::New(isolate, (int) dist._counts.size());
uint32_t pos = 0;
for (vector<uint64_t>::const_iterator i = dist._counts.begin(); i != dist._counts.end(); ++i, ++pos) {
counts->Set(pos, v8::Number::New(isolate, (double) *i));
}
result->Set(TRI_V8_ASCII_STRING("counts"), counts);
list->Set(name, result);
}
// -----------------------------------------------------------------------------
// --SECTION-- JS functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief returns server statistics
///
/// @FUN{internal.serverStatistics()}
///
/// Returns information about the server:
///
/// - `uptime`: time since server start in seconds.
////////////////////////////////////////////////////////////////////////////////
static void JS_ServerStatistics (const v8::FunctionCallbackInfo<v8::Value>& args) {
TRI_V8_TRY_CATCH_BEGIN(isolate)
v8::HandleScope scope(isolate);
TRI_server_statistics_t info = TRI_GetServerStatistics();
v8::Handle<v8::Object> result = v8::Object::New(isolate);
result->Set(TRI_V8_ASCII_STRING("uptime"), v8::Number::New(isolate, (double) info._uptime));
result->Set(TRI_V8_ASCII_STRING("physicalMemory"), v8::Number::New(isolate, (double) TRI_PhysicalMemory));
TRI_V8_RETURN(result);
TRI_V8_TRY_CATCH_END
}
////////////////////////////////////////////////////////////////////////////////
/// @brief returns the current request and connection statistics
////////////////////////////////////////////////////////////////////////////////
static void JS_ClientStatistics (const v8::FunctionCallbackInfo<v8::Value>& args) {
TRI_V8_TRY_CATCH_BEGIN(isolate)
v8::HandleScope scope(isolate);
v8::Handle<v8::Object> result = v8::Object::New(isolate);
StatisticsCounter httpConnections;
StatisticsCounter totalRequests;
vector<StatisticsCounter> methodRequests;
StatisticsCounter asyncRequests;
StatisticsDistribution connectionTime;
TRI_FillConnectionStatistics(httpConnections, totalRequests, methodRequests, asyncRequests, connectionTime);
result->Set(TRI_V8_ASCII_STRING("httpConnections"), v8::Number::New(isolate, (double) httpConnections._count));
FillDistribution(isolate, result, TRI_V8_ASCII_STRING("connectionTime"), connectionTime);
StatisticsDistribution totalTime;
StatisticsDistribution requestTime;
StatisticsDistribution queueTime;
StatisticsDistribution ioTime;
StatisticsDistribution bytesSent;
StatisticsDistribution bytesReceived;
TRI_FillRequestStatistics(totalTime, requestTime, queueTime, ioTime, bytesSent, bytesReceived);
FillDistribution(isolate, result, TRI_V8_ASCII_STRING("totalTime"), totalTime);
FillDistribution(isolate, result, TRI_V8_ASCII_STRING("requestTime"), requestTime);
FillDistribution(isolate, result, TRI_V8_ASCII_STRING("queueTime"), queueTime);
FillDistribution(isolate, result, TRI_V8_ASCII_STRING("ioTime"), ioTime);
FillDistribution(isolate, result, TRI_V8_ASCII_STRING("bytesSent"), bytesSent);
FillDistribution(isolate, result, TRI_V8_ASCII_STRING("bytesReceived"), bytesReceived);
TRI_V8_RETURN(result);
TRI_V8_TRY_CATCH_END
}
////////////////////////////////////////////////////////////////////////////////
/// @brief returns the current http statistics
////////////////////////////////////////////////////////////////////////////////
static void JS_HttpStatistics (const v8::FunctionCallbackInfo<v8::Value>& args) {
TRI_V8_TRY_CATCH_BEGIN(isolate);
v8::HandleScope scope(isolate);
v8::Handle<v8::Object> result = v8::Object::New(isolate);
StatisticsCounter httpConnections;
StatisticsCounter totalRequests;
vector<StatisticsCounter> methodRequests;
StatisticsCounter asyncRequests;
StatisticsDistribution connectionTime;
TRI_FillConnectionStatistics(httpConnections, totalRequests, methodRequests, asyncRequests, connectionTime);
// request counters
result->Set(TRI_V8_ASCII_STRING("requestsTotal"), v8::Number::New(isolate, (double) totalRequests._count));
result->Set(TRI_V8_ASCII_STRING("requestsAsync"), v8::Number::New(isolate, (double) asyncRequests._count));
result->Set(TRI_V8_ASCII_STRING("requestsGet"), v8::Number::New(isolate, (double) methodRequests[(int) HttpRequest::HTTP_REQUEST_GET]._count));
result->Set(TRI_V8_ASCII_STRING("requestsHead"), v8::Number::New(isolate, (double) methodRequests[(int) HttpRequest::HTTP_REQUEST_HEAD]._count));
result->Set(TRI_V8_ASCII_STRING("requestsPost"), v8::Number::New(isolate, (double) methodRequests[(int) HttpRequest::HTTP_REQUEST_POST]._count));
result->Set(TRI_V8_ASCII_STRING("requestsPut"), v8::Number::New(isolate, (double) methodRequests[(int) HttpRequest::HTTP_REQUEST_PUT]._count));
result->Set(TRI_V8_ASCII_STRING("requestsPatch"), v8::Number::New(isolate, (double) methodRequests[(int) HttpRequest::HTTP_REQUEST_PATCH]._count));
result->Set(TRI_V8_ASCII_STRING("requestsDelete"), v8::Number::New(isolate, (double) methodRequests[(int) HttpRequest::HTTP_REQUEST_DELETE]._count));
result->Set(TRI_V8_ASCII_STRING("requestsOptions"), v8::Number::New(isolate, (double) methodRequests[(int) HttpRequest::HTTP_REQUEST_OPTIONS]._count));
result->Set(TRI_V8_ASCII_STRING("requestsOther"), v8::Number::New(isolate, (double) methodRequests[(int) HttpRequest::HTTP_REQUEST_ILLEGAL]._count));
TRI_V8_RETURN(result);
TRI_V8_TRY_CATCH_END
}
// -----------------------------------------------------------------------------
// --SECTION-- module initialisation
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief initializes the statistics functions
////////////////////////////////////////////////////////////////////////////////
void TRI_InitV8Statistics (v8::Isolate* isolate,
v8::Handle<v8::Context> context) {
v8::HandleScope scope(isolate);
// check the isolate
TRI_v8_global_t* v8g = TRI_GetV8Globals(isolate);
TRI_ASSERT(v8g != nullptr);
// .............................................................................
// create the global functions
// .............................................................................
TRI_AddGlobalFunctionVocbase(isolate, context, TRI_V8_ASCII_STRING("SYS_CLIENT_STATISTICS"), JS_ClientStatistics);
TRI_AddGlobalFunctionVocbase(isolate, context, TRI_V8_ASCII_STRING("SYS_HTTP_STATISTICS"), JS_HttpStatistics);
TRI_AddGlobalFunctionVocbase(isolate, context, TRI_V8_ASCII_STRING("SYS_SERVER_STATISTICS"), JS_ServerStatistics);
TRI_AddGlobalVariableVocbase(isolate, context, TRI_V8_ASCII_STRING("CONNECTION_TIME_DISTRIBUTION"), DistributionList(isolate, TRI_ConnectionTimeDistributionVectorStatistics));
TRI_AddGlobalVariableVocbase(isolate, context, TRI_V8_ASCII_STRING("REQUEST_TIME_DISTRIBUTION"), DistributionList(isolate, TRI_RequestTimeDistributionVectorStatistics));
TRI_AddGlobalVariableVocbase(isolate, context, TRI_V8_ASCII_STRING("BYTES_SENT_DISTRIBUTION"), DistributionList(isolate, TRI_BytesSentDistributionVectorStatistics));
TRI_AddGlobalVariableVocbase(isolate, context, TRI_V8_ASCII_STRING("BYTES_RECEIVED_DISTRIBUTION"), DistributionList(isolate, TRI_BytesReceivedDistributionVectorStatistics));
}
// -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE
// -----------------------------------------------------------------------------
// Local Variables:
// mode: outline-minor
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|// --SECTION--\\|/// @\\}"
// End:

View File

@ -0,0 +1,56 @@
////////////////////////////////////////////////////////////////////////////////
/// @brief V8 statistics functions
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2014 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 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 ArangoDB GmbH, Cologne, Germany
///
/// @author Dr. Frank Celler
/// @author Copyright 2014, ArangoDB GmbH, Cologne, Germany
/// @author Copyright 2011-2014, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#ifndef ARANGODB_V8_SERVER_STATISTICS_H
#define ARANGODB_V8_SERVER_STATISTICS_H 1
#include "Basics/Common.h"
#include "V8/v8-globals.h"
// -----------------------------------------------------------------------------
// --SECTION-- GENERAL
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief initializes the statistics functions
////////////////////////////////////////////////////////////////////////////////
void TRI_InitV8Statistics (v8::Isolate* isolate,
v8::Handle<v8::Context>);
#endif
// -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE
// -----------------------------------------------------------------------------
// Local Variables:
// mode: outline-minor
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|// --SECTION--\\|/// @\\}"
// End:

View File

@ -55,6 +55,7 @@
#include "V8/V8LineEditor.h"
#include "V8Server/v8-collection.h"
#include "V8Server/v8-replication.h"
#include "V8Server/v8-statistics.h"
#include "V8Server/v8-voccursor.h"
#include "V8Server/v8-vocindex.h"
#include "V8Server/v8-wrapshapedjson.h"
@ -3835,6 +3836,8 @@ void TRI_InitV8VocBridge (v8::Isolate* isolate,
TRI_AddMethodVocbase(isolate, ArangoNS, TRI_V8_ASCII_STRING("_dropDatabase"), JS_DropDatabase);
TRI_AddMethodVocbase(isolate, ArangoNS, TRI_V8_ASCII_STRING("_listDatabases"), JS_ListDatabases);
TRI_AddMethodVocbase(isolate, ArangoNS, TRI_V8_ASCII_STRING("_useDatabase"), JS_UseDatabase);
TRI_InitV8Statistics(isolate, context);
TRI_InitV8indexArangoDB(isolate, ArangoNS);

View File

@ -59,6 +59,15 @@
#include "Basics/logging.h"
#include "Basics/StringUtils.h"
// -----------------------------------------------------------------------------
// --SECTION-- global variables
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief physical memory
////////////////////////////////////////////////////////////////////////////////
uint64_t TRI_PhysicalMemory;
// -----------------------------------------------------------------------------
// --SECTION-- private types
@ -1318,9 +1327,71 @@ bool TRI_KillExternalProcess (TRI_external_id_t pid) {
TRI_RemoveVectorPointer(&ExternalProcesses, i);
TRI_UnlockMutex(&ExternalProcessesLock);
FreeExternal(external);
return ok;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief gets the physical memory
////////////////////////////////////////////////////////////////////////////////
#if (defined(BSD) || defined(TRI_HAVE_MACOS_MEM_STATS))
static uint64_t GetPhysicalMemory () {
int mib[2];
int64_t physicalMemory;
size_t length;
// Get the Physical memory size
mib[0] = CTL_HW;
#ifdef TRI_HAVE_MACOS_MEM_STATS
mib[1] = HW_MEMSIZE;
#else
mib[1] = HW_PHYSMEM; // The bytes of physical memory. (kenel + user space)
#endif
length = sizeof(int64_t);
sysctl(mib, 2, &physicalMemory, &length, nullptr, 0);
return (uint64_t) physicalMemory;
}
#else
#ifdef TRI_HAVE_SC_PHYS_PAGES
static uint64_t GetPhysicalMemory () {
long pages = sysconf(_SC_PHYS_PAGES);
long page_size = sysconf(_SC_PAGE_SIZE);
return (uint64_t)(pages * page_size);
}
#else
#ifdef TRI_HAVE_WIN32_GLOBAL_MEMORY_STATUS
static uint64_t GetPhysicalMemory () {
MEMORYSTATUSEX status;
status.dwLength = sizeof(status);
GlobalMemoryStatusEx(&status);
return (uint64_t) status.ullTotalPhys;
}
#else
static uint64_t GetPhysicalMemory () {
PROCESS_MEMORY_COUNTERS pmc;
memset(&result, 0, sizeof(result));
pmc.cb = sizeof(PROCESS_MEMORY_COUNTERS);
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms684874(v=vs.85).aspx
if (GetProcessMemoryInfo(GetCurrentProcess(), &pmc, pmc.cb)) {
return pmc.PeakWorkingSetSize;
}
return 0;
}
#endif
#endif
#endif
// -----------------------------------------------------------------------------
// --SECTION-- MODULE
// -----------------------------------------------------------------------------
@ -1334,6 +1405,8 @@ bool TRI_KillExternalProcess (TRI_external_id_t pid) {
////////////////////////////////////////////////////////////////////////////////
void TRI_InitialiseProcess (int argc, char* argv[]) {
TRI_PhysicalMemory = GetPhysicalMemory();
if (ProcessName != nullptr) {
return;
}

View File

@ -31,7 +31,6 @@
#define ARANGODB_BASICS_C_PROCESS__UTILS_H 1
#include "Basics/Common.h"
#include "Basics/threads.h"
// -----------------------------------------------------------------------------
@ -52,6 +51,12 @@
// --SECTION-- public types
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief physical memory
////////////////////////////////////////////////////////////////////////////////
extern uint64_t TRI_PhysicalMemory;
////////////////////////////////////////////////////////////////////////////////
/// @brief returns information about the process
////////////////////////////////////////////////////////////////////////////////
@ -173,11 +178,12 @@ void TRI_SetProcessTitle (char const* title);
////////////////////////////////////////////////////////////////////////////////
/// @brief starts an external process
////////////////////////////////////////////////////////////////////////////////
void TRI_CreateExternalProcess (const char* executable,
const char** arguments,
void TRI_CreateExternalProcess (char const* executable,
char const** arguments,
size_t n,
bool usePipes,
TRI_external_id_t * pid);
TRI_external_id_t* pid);
////////////////////////////////////////////////////////////////////////////////
/// @brief returns the status of an external process

View File

@ -105,19 +105,16 @@ add_library(
Basics/xxhash.cpp
JsonParser/json-parser.cpp
ProgramOptions/program-options.cpp
Rest/AnyServer.cpp
Rest/EndpointList.cpp
Rest/Endpoint.cpp
Rest/EndpointIp.cpp
Rest/EndpointIpV4.cpp
Rest/EndpointIpV6.cpp
Rest/Handler.cpp
Rest/HttpRequest.cpp
Rest/HttpResponse.cpp
Rest/InitialiseRest.cpp
Rest/SslInterface.cpp
Rest/Version.cpp
Statistics/statistics.cpp
Utilities/DummyShell.cpp
Utilities/LineEditor.cpp
Utilities/ScriptLoader.cpp
@ -143,53 +140,6 @@ add_library(
SimpleHttpClient/SimpleHttpResult.cpp
)
################################################################################
### @brief LIB_ARANGO_FE
################################################################################
add_library(
${LIB_ARANGO_FE}
STATIC
Admin/ApplicationAdminServer.cpp
Admin/RestAdminBaseHandler.cpp
Admin/RestAdminLogHandler.cpp
Admin/RestBaseHandler.cpp
Admin/RestDebugHelperHandler.cpp
Admin/RestJobHandler.cpp
Admin/RestShutdownHandler.cpp
Admin/RestVersionHandler.cpp
ApplicationServer/ApplicationFeature.cpp
ApplicationServer/ApplicationServer.cpp
Dispatcher/ApplicationDispatcher.cpp
Dispatcher/Dispatcher.cpp
Dispatcher/DispatcherQueue.cpp
Dispatcher/DispatcherThread.cpp
Dispatcher/Job.cpp
Dispatcher/RequeueTask.cpp
HttpServer/ApplicationEndpointServer.cpp
HttpServer/AsyncJobManager.cpp
HttpServer/HttpCommTask.cpp
HttpServer/HttpHandler.cpp
HttpServer/HttpHandlerFactory.cpp
HttpServer/HttpListenTask.cpp
HttpServer/HttpServer.cpp
HttpServer/HttpServerJob.cpp
HttpServer/HttpsCommTask.cpp
HttpServer/HttpsServer.cpp
HttpServer/PathHandler.cpp
Scheduler/ApplicationScheduler.cpp
Scheduler/ListenTask.cpp
Scheduler/PeriodicTask.cpp
Scheduler/Scheduler.cpp
Scheduler/SchedulerLibev.cpp
Scheduler/SchedulerThread.cpp
Scheduler/SignalTask.cpp
Scheduler/SocketTask.cpp
Scheduler/Task.cpp
Scheduler/TaskManager.cpp
Scheduler/TimerTask.cpp
)
################################################################################
### @brief LIB_ARANGO_V8
################################################################################

View File

@ -77,20 +77,17 @@ lib_libarango_a_SOURCES = \
lib/Basics/xxhash.cpp \
lib/JsonParser/json-parser.cpp \
lib/ProgramOptions/program-options.cpp \
lib/Rest/AnyServer.cpp \
lib/Rest/EndpointList.cpp \
lib/Rest/Endpoint.cpp \
lib/Rest/EndpointIp.cpp \
lib/Rest/EndpointIpV4.cpp \
lib/Rest/EndpointIpV6.cpp \
lib/Rest/EndpointUnixDomain.cpp \
lib/Rest/Handler.cpp \
lib/Rest/HttpRequest.cpp \
lib/Rest/HttpResponse.cpp \
lib/Rest/InitialiseRest.cpp \
lib/Rest/SslInterface.cpp \
lib/Rest/Version.cpp \
lib/Statistics/statistics.cpp \
lib/Utilities/DummyShell.cpp \
lib/Utilities/LineEditor.cpp \
lib/Utilities/ScriptLoader.cpp \
@ -119,50 +116,6 @@ lib_libarango_client_a_SOURCES = \
lib/SimpleHttpClient/SimpleHttpResult.cpp \
lib/SimpleHttpClient/ConnectionManager.cpp
################################################################################
### @brief library "libarango.a", front-end part
################################################################################
lib_libarango_fe_a_SOURCES = \
lib/Admin/ApplicationAdminServer.cpp \
lib/Admin/RestAdminBaseHandler.cpp \
lib/Admin/RestAdminLogHandler.cpp \
lib/Admin/RestBaseHandler.cpp \
lib/Admin/RestDebugHelperHandler.cpp \
lib/Admin/RestJobHandler.cpp \
lib/Admin/RestShutdownHandler.cpp \
lib/Admin/RestVersionHandler.cpp \
lib/ApplicationServer/ApplicationFeature.cpp \
lib/ApplicationServer/ApplicationServer.cpp \
lib/Dispatcher/ApplicationDispatcher.cpp \
lib/Dispatcher/Dispatcher.cpp \
lib/Dispatcher/DispatcherQueue.cpp \
lib/Dispatcher/DispatcherThread.cpp \
lib/Dispatcher/Job.cpp \
lib/Dispatcher/RequeueTask.cpp \
lib/HttpServer/ApplicationEndpointServer.cpp \
lib/HttpServer/AsyncJobManager.cpp \
lib/HttpServer/HttpCommTask.cpp \
lib/HttpServer/HttpHandler.cpp \
lib/HttpServer/HttpHandlerFactory.cpp \
lib/HttpServer/HttpListenTask.cpp \
lib/HttpServer/HttpServer.cpp \
lib/HttpServer/HttpServerJob.cpp \
lib/HttpServer/HttpsCommTask.cpp \
lib/HttpServer/HttpsServer.cpp \
lib/HttpServer/PathHandler.cpp \
lib/Scheduler/ApplicationScheduler.cpp \
lib/Scheduler/ListenTask.cpp \
lib/Scheduler/PeriodicTask.cpp \
lib/Scheduler/Scheduler.cpp \
lib/Scheduler/SchedulerLibev.cpp \
lib/Scheduler/SchedulerThread.cpp \
lib/Scheduler/SignalTask.cpp \
lib/Scheduler/SocketTask.cpp \
lib/Scheduler/Task.cpp \
lib/Scheduler/TaskManager.cpp \
lib/Scheduler/TimerTask.cpp
################################################################################
### @brief library "libarango.a", JavaScript part
################################################################################

View File

@ -29,7 +29,6 @@
////////////////////////////////////////////////////////////////////////////////
#include "HttpRequest.h"
#include "Basics/conversions.h"
#include "Basics/logging.h"
#include "Basics/StringBuffer.h"

Some files were not shown because too many files have changed in this diff Show More