summaryrefslogtreecommitdiff
path: root/drivers/misc
diff options
context:
space:
mode:
authorMike Chan <mike@android.com>2010-05-28 14:32:19 -0700
committerNitin Garg <nitin.garg@freescale.com>2014-04-21 22:34:43 -0500
commit6dc817dc7a0b24351d8f5f1ecebdf7959d16a6fd (patch)
tree9dd23ef4ec3a84a899af3e253c7dd7e052e5f6da /drivers/misc
parent3a5d3f86f6181e68cf4202178f306fd9ef9c5ef3 (diff)
net: activity_stats: Add statistics for network transmission activity
When enabled, tracks the frequency of network transmissions (inbound and outbound) and buckets them accordingly. Buckets are determined by time between network activity. Each bucket represents the number of network transmisions that were N sec or longer apart. Where N is defined as 1 << bucket index. This network pattern tracking is particularly useful for wireless networks (ie: 3G) where batching network activity closely together is more power efficient than far apart. New file: /proc/net/stat/activity output: Min Bucket(sec) Count 1 7 2 0 4 1 8 0 16 0 32 2 64 1 128 0 Change-Id: I4c4cd8627b872a55f326b1715c51bc3bdd6e8d92 Signed-off-by: Mike Chan <mike@android.com>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/uid_stat.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/misc/uid_stat.c b/drivers/misc/uid_stat.c
index e6760b56083c..2141124a6c12 100644
--- a/drivers/misc/uid_stat.c
+++ b/drivers/misc/uid_stat.c
@@ -24,6 +24,7 @@
#include <linux/spinlock.h>
#include <linux/stat.h>
#include <linux/uid_stat.h>
+#include <net/activity_stats.h>
static DEFINE_SPINLOCK(uid_lock);
static LIST_HEAD(uid_list);
@@ -122,6 +123,7 @@ static struct uid_stat *create_stat(uid_t uid) {
int uid_stat_tcp_snd(uid_t uid, int size) {
struct uid_stat *entry;
+ activity_stats_update();
if ((entry = find_uid_stat(uid)) == NULL &&
((entry = create_stat(uid)) == NULL)) {
return -1;
@@ -132,6 +134,7 @@ int uid_stat_tcp_snd(uid_t uid, int size) {
int uid_stat_tcp_rcv(uid_t uid, int size) {
struct uid_stat *entry;
+ activity_stats_update();
if ((entry = find_uid_stat(uid)) == NULL &&
((entry = create_stat(uid)) == NULL)) {
return -1;