aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/stats/statistics.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/stats/statistics.c')
-rw-r--r--src/plugins/stats/statistics.c62
1 files changed, 18 insertions, 44 deletions
diff --git a/src/plugins/stats/statistics.c b/src/plugins/stats/statistics.c
index e8347fce..9a4be685 100644
--- a/src/plugins/stats/statistics.c
+++ b/src/plugins/stats/statistics.c
@@ -1,5 +1,6 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 (C) 2004, 2005 Christian Grothoff (and other contributing authors)
3 4
4 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -24,13 +25,16 @@
24 - add any more StatEntries, update menu accordingly. 25 - add any more StatEntries, update menu accordingly.
25*/ 26*/
26 27
27#include "gnunet_afs_esed2.h" 28#include "platform.h"
28#include "statistics.h" 29#include "gnunetgtk_common.h"
29#include "helper.h" 30#include <GNUnet/gnunet_stats_lib.h>
30#include "main.h"
31#include <glib.h>
32 31
33#define UPDATE_INTERVAL (30 * cronSECONDS) 32#define UPDATE_INTERVAL (30 * cronSECONDS)
33#define STAT_CONNECTIVITY 0
34#define STAT_CPU_LOAD 1
35#define STAT_IN_TRAFFIC 2
36#define STAT_OUT_TRAFFIC 3
37
34 38
35typedef struct { 39typedef struct {
36 char * statName; 40 char * statName;
@@ -481,18 +485,6 @@ static void statClose(void) {
481 gtk_widget_draw(GTK_WIDGET(notebook), NULL); 485 gtk_widget_draw(GTK_WIDGET(notebook), NULL);
482} 486}
483 487
484static GtkItemFactoryEntry statWindowMenu[] = {
485 {
486 gettext_noop("/Close display"),
487 NULL,
488 statClose,
489 0,
490 "<Item>"
491 }
492};
493static gint statWindowMenuItems
494 = sizeof (statWindowMenu) / sizeof (statWindowMenu[0]);
495
496 488
497/** 489/**
498 */ 490 */
@@ -911,37 +903,19 @@ static GtkWidget * create_main_window(int stat) {
911} 903}
912 904
913 905
914/**
915 * Display the statistics.
916 */
917void displayStatistics(GtkWidget * widget,
918 gpointer data) {
919 int dptr;
920 GtkWidget * wid;
921
922 dptr = (int) data;
923 if ( (dptr < 0) ||
924 (dptr >= STATS_COUNT) ) {
925 BREAK();
926 } else {
927 wid = create_main_window(dptr);
928 if (wid != NULL)
929 addToNotebook(_(stats[dptr].paneName),
930 wid);
931 }
932}
933 906
934void initGTKStatistics() { 907
908
909void init_stats() {
935 MUTEX_CREATE_RECURSIVE(&lock); 910 MUTEX_CREATE_RECURSIVE(&lock);
911 wid = create_main_window(dptr);
912 if (wid != NULL)
913 addToNotebook(_(stats[dptr].paneName),
914 wid);
915
936} 916}
937 917
938void doneGTKStatistics() { 918void done_stats() {
939 unsigned int i;
940 for (i=0;i<lsv_size;i++)
941 FREE(lastStatValues[i].statName);
942 GROW(lastStatValues,
943 lsv_size,
944 0);
945 MUTEX_DESTROY(&lock); 919 MUTEX_DESTROY(&lock);
946} 920}
947 921