summaryrefslogtreecommitdiffstats
path: root/src/global_statistics.c
diff options
context:
space:
mode:
authorFederico Ceratto <federico.ceratto@gmail.com>2016-11-23 15:49:10 +0000
committerFederico Ceratto <federico.ceratto@gmail.com>2016-11-23 15:49:10 +0000
commit87649cf32bd0e14d5a903fb85b01e9f41a253540 (patch)
treebbefda6dac074aeb87529592e8e5064f69cbe024 /src/global_statistics.c
parentImported Upstream version 1.3.0+dfsg (diff)
downloadnetdata-87649cf32bd0e14d5a903fb85b01e9f41a253540.tar.xz
netdata-87649cf32bd0e14d5a903fb85b01e9f41a253540.zip
New upstream version 1.4.0+dfsgupstream/1.4.0+dfsg
Diffstat (limited to 'src/global_statistics.c')
-rw-r--r--src/global_statistics.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/global_statistics.c b/src/global_statistics.c
index f39a4cf25..bb2b1f08f 100644
--- a/src/global_statistics.c
+++ b/src/global_statistics.c
@@ -25,7 +25,7 @@ void finished_web_request_statistics(uint64_t dt,
uint64_t bytes_sent,
uint64_t content_size,
uint64_t compressed_content_size) {
-#ifndef NETDATA_NO_ATOMIC_INSTRUCTIONS
+#if defined(HAVE_C___ATOMIC) && !defined(NETDATA_NO_ATOMIC_INSTRUCTIONS)
uint64_t old_web_usec_max = global_statistics.web_usec_max;
while(dt > old_web_usec_max)
__atomic_compare_exchange(&global_statistics.web_usec_max, &old_web_usec_max, &dt, 1, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
@@ -57,7 +57,7 @@ void finished_web_request_statistics(uint64_t dt,
}
void web_client_connected(void) {
-#ifndef NETDATA_NO_ATOMIC_INSTRUCTIONS
+#if defined(HAVE_C___ATOMIC) && !defined(NETDATA_NO_ATOMIC_INSTRUCTIONS)
__atomic_fetch_add(&global_statistics.connected_clients, 1, __ATOMIC_SEQ_CST);
#else
if (web_server_mode == WEB_SERVER_MODE_MULTI_THREADED)
@@ -71,7 +71,7 @@ void web_client_connected(void) {
}
void web_client_disconnected(void) {
-#ifndef NETDATA_NO_ATOMIC_INSTRUCTIONS
+#if defined(HAVE_C___ATOMIC) && !defined(NETDATA_NO_ATOMIC_INSTRUCTIONS)
__atomic_fetch_sub(&global_statistics.connected_clients, 1, __ATOMIC_SEQ_CST);
#else
if (web_server_mode == WEB_SERVER_MODE_MULTI_THREADED)
@@ -86,7 +86,7 @@ void web_client_disconnected(void) {
inline void global_statistics_copy(struct global_statistics *gs, uint8_t options) {
-#ifndef NETDATA_NO_ATOMIC_INSTRUCTIONS
+#if defined(HAVE_C___ATOMIC) && !defined(NETDATA_NO_ATOMIC_INSTRUCTIONS)
gs->connected_clients = __atomic_fetch_add(&global_statistics.connected_clients, 0, __ATOMIC_SEQ_CST);
gs->web_requests = __atomic_fetch_add(&global_statistics.web_requests, 0, __ATOMIC_SEQ_CST);
gs->web_usec = __atomic_fetch_add(&global_statistics.web_usec, 0, __ATOMIC_SEQ_CST);
@@ -259,4 +259,4 @@ void global_statistics_charts(void) {
rrddim_set(stcompression, "savings", compression_ratio);
rrdset_done(stcompression);
-} \ No newline at end of file
+}