[PVFS2-CVS] commit by rbross in pvfs2/src/apps/karma: comm.c details.c

CVS commit program pvfs2-internal@beowulf-underground.org
Sun, 1 Feb 2004 19:53:50 -0500


Update of /projects/cvsroot/pvfs2/src/apps/karma
In directory parlweb.parl.clemson.edu:/tmp/cvs-serv4655

Modified Files:
	comm.c details.c 
Log Message:
added some fake stats that can be used if desired (for testing).  sorting still off, since i can't seem to make it work right.


Index: comm.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/karma/comm.c,v
diff -p -u -r1.8 -r1.9
--- comm.c	29 Jan 2004 22:49:13 -0000	1.8
+++ comm.c	2 Feb 2004 00:53:50 -0000	1.9
@@ -8,6 +8,8 @@
 
 #include "karma.h"
 
+#undef FAKE_STATS
+
 static pvfs_mntlist mnt = {0, NULL};
 static struct PVFS_mgmt_server_stat *visible_stats = NULL;
 static struct PVFS_mgmt_server_stat *internal_stats = NULL;
@@ -19,6 +21,17 @@ GtkListStore *gui_comm_fslist;
 static PVFS_credentials creds;
 static PVFS_fs_id cur_fsid = -1;
 
+#ifdef FAKE_STATS
+static struct PVFS_mgmt_server_stat fake_stats[] = {
+    { 9, 1048576, 2*1048576, 2048, 1024, 102, 4096, 8192, "node0", 3 },
+    { 9, 524288, 2*1048576, 1024, 512, 500, 256, 8192, "node2", 3 },
+    { 9, 524288, 2*1048576, 2048, 512, 102, 512, 1024, "node1", 1 },
+    { 9, 1048576, 2*1048576, 1024, 256, 302, 4096, 8192, "node3", 2 },
+    { 9, 1048576, 2*1048576, 1024, 512, 102, 1024, 8192, "node4", 1 }
+};
+static int fake_stat_ct = sizeof(fake_stats) / sizeof(*fake_stats);
+#endif
+
 /* internal fn prototypes */
 static int gui_comm_stats_collect(void);
 
@@ -121,6 +134,9 @@ void gui_comm_set_active_fs(char *contac
     int ret, outcount;
     char msgbuf[80];
 
+#ifdef FAKE_STATS
+    return;
+#else
     snprintf(msgbuf, 80, "Karma: %s/%s", contact_server, fs_name);
     gui_set_title(msgbuf);
 
@@ -147,7 +163,7 @@ void gui_comm_set_active_fs(char *contac
     internal_stats   = (struct PVFS_mgmt_server_stat *)
 	malloc(outcount * sizeof(struct PVFS_mgmt_server_stat));
     internal_stat_ct = outcount;
-
+#endif
 }
 
 /* gui_comm_stats_retrieve(**svr_stat, *svr_stat_ct)
@@ -164,6 +180,11 @@ int gui_comm_stats_retrieve(struct PVFS_
 {
     int ret;
 
+#ifdef FAKE_STATS
+    *svr_stat = fake_stats;
+    *svr_stat_ct = fake_stat_ct;
+    return 0;
+#else
     /* for now, call gui_comm_stats_collect() to get new data */
     ret = gui_comm_stats_collect();
     if (ret != 0) return ret;
@@ -182,6 +203,7 @@ int gui_comm_stats_retrieve(struct PVFS_
     *svr_stat_ct = visible_stat_ct;
 
     return 0;
+#endif
 }
 
 /* gui_comm_stats_collect()
@@ -195,6 +217,9 @@ static int gui_comm_stats_collect(void)
     int ret, outcount;
     PVFS_id_gen_t *addr_array;
 
+#ifdef FAKE_STATS
+    return 0;
+#else
     addr_array = (PVFS_id_gen_t*) malloc(internal_stat_ct * sizeof(PVFS_id_gen_t));
     if (!addr_array)
     {
@@ -226,6 +251,6 @@ static int gui_comm_stats_collect(void)
     }
 
     free(addr_array);
-
+#endif
     return 0;
 }

Index: details.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/karma/details.c,v
diff -p -u -r1.7 -r1.8
--- details.c	30 Jan 2004 22:13:02 -0000	1.7
+++ details.c	2 Feb 2004 00:53:50 -0000	1.8
@@ -82,6 +82,7 @@ GtkWidget *gui_details_setup(void)
     gtk_tree_view_set_model(GTK_TREE_VIEW(gui_details_view),
 			    GTK_TREE_MODEL(gui_details_list));
 
+    /* NOTE: SORTING CAUSES BIG PROBLEMS; DISABLED UNTIL WE KNOW MORE */
 #if 0
     /* for all the numerical values, set up sorting */
     for (i=1; i < GUI_DETAILS_TYPE; i++) {
@@ -109,7 +110,7 @@ GtkWidget *gui_details_setup(void)
 				    gui_details_text_compare,
 				    GINT_TO_POINTER(GUI_DETAILS_TYPE),
 				    NULL);
-    
+
     gtk_tree_view_column_set_sort_column_id(gui_details_col[GUI_DETAILS_TYPE],
 					    GUI_DETAILS_TYPE);
 #endif