diff options
author | Christian Grothoff <christian@grothoff.org> | 2005-07-08 22:11:24 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2005-07-08 22:11:24 +0000 |
commit | ec0b9bbe539605c1f1d2acae569d30aed9317bb7 (patch) | |
tree | 86b00d5704cf88ab05883bb61129b80d5fabef63 | |
parent | b1c5980d71c5957a5f8ce49205bbba2c1aa04456 (diff) | |
download | gnunet-gtk-ec0b9bbe539605c1f1d2acae569d30aed9317bb7.tar.gz gnunet-gtk-ec0b9bbe539605c1f1d2acae569d30aed9317bb7.zip |
update
-rw-r--r-- | src/plugins/stats/Makefile.am | 19 | ||||
-rw-r--r-- | src/plugins/stats/statistics.c | 62 | ||||
-rw-r--r-- | src/plugins/stats/statistics.h | 49 |
3 files changed, 37 insertions, 93 deletions
diff --git a/src/plugins/stats/Makefile.am b/src/plugins/stats/Makefile.am new file mode 100644 index 00000000..3f93b2a6 --- /dev/null +++ b/src/plugins/stats/Makefile.am | |||
@@ -0,0 +1,19 @@ | |||
1 | INCLUDES = \ | ||
2 | -I$(top_srcdir)/intl \ | ||
3 | -I$(top_srcdir)/src/include \ | ||
4 | @GTK_CFLAGS@ \ | ||
5 | @GNUNETGTK_CFLAGS@ | ||
6 | |||
7 | plugindir = $(libdir)/GNUnet | ||
8 | |||
9 | plugin_LTLIBRARIES = \ | ||
10 | libgnunetgtkmodule_stats.la | ||
11 | |||
12 | libgnunetgtkmodule_stats_la_SOURCES = \ | ||
13 | statistics.c | ||
14 | libgnunetgtkmodule_stats_la_LIBADD = \ | ||
15 | $(top_builddir)/src/common/libgnunetgtk_common.la \ | ||
16 | -lgnunetutil \ | ||
17 | -lgnunetstats_api | ||
18 | libgnunetgtkmodule_stats_la_LDFLAGS = \ | ||
19 | -export-dynamic -avoid-version -module | ||
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 | ||
35 | typedef struct { | 39 | typedef 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 | ||
484 | static GtkItemFactoryEntry statWindowMenu[] = { | ||
485 | { | ||
486 | gettext_noop("/Close display"), | ||
487 | NULL, | ||
488 | statClose, | ||
489 | 0, | ||
490 | "<Item>" | ||
491 | } | ||
492 | }; | ||
493 | static 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 | */ | ||
917 | void 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 | ||
934 | void initGTKStatistics() { | 907 | |
908 | |||
909 | void 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 | ||
938 | void doneGTKStatistics() { | 918 | void 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 | ||
diff --git a/src/plugins/stats/statistics.h b/src/plugins/stats/statistics.h deleted file mode 100644 index 536d4855..00000000 --- a/src/plugins/stats/statistics.h +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | |||
4 | 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 | by the Free Software Foundation; either version 2, or (at your | ||
7 | option) any later version. | ||
8 | |||
9 | GNUnet is distributed in the hope that it will be useful, but | ||
10 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with GNUnet; see the file COPYING. If not, write to the | ||
16 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
17 | Boston, MA 02111-1307, USA. | ||
18 | */ | ||
19 | |||
20 | /** | ||
21 | * @file applications/afs/gtkui/statistics.h | ||
22 | * @author Christian Grothoff | ||
23 | **/ | ||
24 | |||
25 | #ifndef GTKUI_STATISTICS_H | ||
26 | #define GTKUI_STATISTICS_H | ||
27 | |||
28 | #include "platform.h" | ||
29 | #include <gtk/gtk.h> | ||
30 | #include <gtk/gtktext.h> | ||
31 | |||
32 | /** | ||
33 | * Display the statistics. | ||
34 | */ | ||
35 | void displayStatistics(GtkWidget * widget, | ||
36 | gpointer data); | ||
37 | |||
38 | |||
39 | void initGTKStatistics(); | ||
40 | |||
41 | void doneGTKStatistics(); | ||
42 | |||
43 | #define STAT_CONNECTIVITY 0 | ||
44 | #define STAT_CPU_LOAD 1 | ||
45 | #define STAT_IN_TRAFFIC 2 | ||
46 | #define STAT_OUT_TRAFFIC 3 | ||
47 | |||
48 | |||
49 | #endif | ||