From 6c82282da3b35b2acf46f69655cd0d097058af24 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 29 Apr 2017 16:12:19 +1200 Subject: Save more statistics info --- src/org/traccar/database/StatisticsManager.java | 34 ++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'src/org/traccar/database/StatisticsManager.java') diff --git a/src/org/traccar/database/StatisticsManager.java b/src/org/traccar/database/StatisticsManager.java index 5b0aa5f41..8abadddc5 100644 --- a/src/org/traccar/database/StatisticsManager.java +++ b/src/org/traccar/database/StatisticsManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Anton Tananaev (anton@traccar.org) + * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,6 +37,10 @@ public class StatisticsManager { private int requests; private int messagesReceived; private int messagesStored; + private int mailSent; + private int smsSent; + private int geocoderRequests; + private int geolocationRequests; private void checkSplit() { int currentUpdate = Calendar.getInstance().get(SPLIT_MODE); @@ -48,6 +52,10 @@ public class StatisticsManager { statistics.setRequests(requests); statistics.setMessagesReceived(messagesReceived); statistics.setMessagesStored(messagesStored); + statistics.setMailSent(mailSent); + statistics.setSmsSent(smsSent); + statistics.setGeocoderRequests(geocoderRequests); + statistics.setGeolocationRequests(geolocationRequests); try { Context.getDataManager().addStatistics(statistics); @@ -60,6 +68,10 @@ public class StatisticsManager { requests = 0; messagesReceived = 0; messagesStored = 0; + mailSent = 0; + smsSent = 0; + geocoderRequests = 0; + geolocationRequests = 0; lastUpdate = currentUpdate; } } @@ -85,4 +97,24 @@ public class StatisticsManager { } } + public synchronized void registerMail() { + checkSplit(); + mailSent += 1; + } + + public synchronized void registerSms() { + checkSplit(); + smsSent += 1; + } + + public synchronized void registerGeocoderRequest() { + checkSplit(); + geocoderRequests += 1; + } + + public synchronized void registerGeolocationRequest() { + checkSplit(); + geolocationRequests += 1; + } + } -- cgit v1.2.3