Permalink
Browse files

Add mdsl realtime I/O profile to ROOT info.

  • Loading branch information...
1 parent d212c1a commit ef1aee525652474b2b7057ce74a0315092dc68fa @macan committed May 23, 2012
Showing with 101 additions and 22 deletions.
  1. +2 −1 Makefile.inc
  2. +2 −2 bin/hvfs.sh
  3. +2 −2 branch/Makefile
  4. +8 −1 include/profile.h
  5. +56 −1 r2/profile.c
  6. +2 −1 r2/root.c
  7. +7 −1 r2/root.h
  8. +10 −1 r2/x2r.c
  9. +2 −2 test/mds/embedpy.c
  10. +2 −2 test/mds/itb_analyzer.c
  11. +8 −8 test/xnet/root.c
View
@@ -2,7 +2,7 @@
# Copyright (c) 2009 Ma Can <ml.macana@gmail.com>
# <macan@ncic.ac.cn>
#
-# Time-stamp: <2012-05-16 18:09:03 macan>
+# Time-stamp: <2012-05-22 09:40:38 macan>
#
# This is the makefile for HVFS project.
#
@@ -13,6 +13,7 @@ LD = gcc
AR = ar
PYTHON = env python
GIT = env git
+ECHO = echo
INC_PATH = $(HOME_PATH)/include
LIB_PATH = $(HOME_PATH)/lib
View
@@ -3,7 +3,7 @@
# Copyright (c) 2009 Ma Can <ml.macana@gmail.com>
# <macan@ncic.ac.cn>
#
-# Time-stamp: <2012-05-18 12:10:52 macan>
+# Time-stamp: <2012-05-18 15:48:24 macan>
#
# This is the mangement script for Pomegranate
#
@@ -82,7 +82,7 @@ function do_ut_conf_check() {
# Read the config file and start the servers
-ROOT_CMD="create=0 mode=1 hvfs_root_hb_interval=10"
+ROOT_CMD="LOG_DIR=$LOG_DIR create=0 mode=1 hvfs_root_hb_interval=10"
#Construct the mdsl command line
if [ -e $HVFS_HOME/conf/mdsl.conf ]; then
View
@@ -2,7 +2,7 @@
# Copyright (c) 2009 Ma Can <ml.macana@gmail.com>
# <macan@ncic.ac.cn>
#
-# Time-stamp: <2011-04-12 13:28:33 macan>
+# Time-stamp: <2012-05-22 11:03:59 macan>
#
# This is the makefile for HVFS project.
#
@@ -21,7 +21,7 @@ branch_so : $(BRANCH_AR_SOURCE:.c=.o) $(XNET_LIB)
@echo -e " " AR"\t" $@
@$(AR) rcs libbranch.a $(^:.c=.o)
@echo -e " " SL"\t" $(BRANCH_SO)
- @$(CC) $(BDBFLAGS) -L$(XNET) -shared -Wl,-soname,libbranch.so.1 -o $(LIB_PATH)/libbranch.so.1.0 $(^:.c=.o) -lc -lrt -lpthread -lxnet
+ @$(CC) -shared -Wl,-soname,libbranch.so.1 -o $(LIB_PATH)/libbranch.so.1.0 $(^:.c=.o) -lc -lrt -lpthread $(BDBFLAGS) -L$(XNET) -lxnet
clean :
-@rm -rf $(BRANCH_AR_SOURCE:.c=.o)
View
@@ -3,7 +3,7 @@
* <macan@ncic.ac.cn>
*
* Armed with EMACS.
- * Time-stamp: <2011-06-23 10:42:15 macan>
+ * Time-stamp: <2012-05-22 16:25:22 macan>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -60,6 +60,13 @@ struct hvfs_profile_mds_rate
u64 last_modify, last_nonmodify;
};
+struct hvfs_profile_mdsl_rate
+{
+ time_t last_update;
+ double write, read; /* rates */
+ u64 last_write, last_read;
+};
+
#define HVFS_PROFILE_NAME_ADDIN(hp, idx, iname) do { \
(hp)->hpe[idx++].name = strdup(iname); \
} while (0)
View
@@ -3,7 +3,7 @@
* <macan@ncic.ac.cn>
*
* Armed with EMACS.
- * Time-stamp: <2011-06-23 11:09:58 macan>
+ * Time-stamp: <2012-05-22 17:18:49 macan>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@
#include "root.h"
static struct hvfs_profile_mds_rate g_hpmr = {0, 0.0, 0.0, 0, 0,};
+static struct hvfs_profile_mdsl_rate g_hpmlr = {0, 0.0, 0.0, 0, 0,};
/* This profile unit recv requests from other sites and write to corresponding
* log file
@@ -217,6 +218,26 @@ void __root_profile_update_mds_rate(struct hvfs_profile_ex *hp)
g_hpmr.last_nonmodify = hp->hpe[2].value;
}
+/* try to update data I/O rate on each mdsl profile update */
+static inline
+void __root_profile_update_mdsl_rate(struct hvfs_profile_ex *hp)
+{
+ time_t cur = time(NULL);
+
+ if (cur == g_hpmlr.last_update)
+ return;
+
+ /* 17th entry is write counter */
+ g_hpmlr.write = (double)(hp->hpe[17].value - g_hpmlr.last_write) /
+ (cur - g_hpmlr.last_update);
+ g_hpmlr.read = (double)(hp->hpe[18].value - g_hpmlr.last_read) /
+ (cur - g_hpmlr.last_update);
+
+ g_hpmlr.last_update = cur;
+ g_hpmlr.last_write = hp->hpe[17].value;
+ g_hpmlr.last_read = hp->hpe[18].value;
+}
+
int root_profile_update_mds(struct hvfs_profile *hp,
struct xnet_msg *msg)
{
@@ -255,6 +276,8 @@ int root_profile_update_mdsl(struct hvfs_profile *hp,
HVFS_PROFILE_VALUE_UPDATE(&hro.hp_mdsl, hp, i);
}
+ __root_profile_update_mdsl_rate(&hro.hp_mdsl);
+
out:
return err;
}
@@ -347,3 +370,35 @@ int root_info_mds(u64 arg, void **buf)
out:
return err;
}
+
+int root_info_mdsl(u64 arg, void **buf)
+{
+ char *p;
+ int err = 0, i;
+
+ p = xzalloc(4096 << 2);
+ if (!p) {
+ hvfs_err(root, "xzalloc() info mdsl buffer failed\n");
+ err = -ENOMEM;
+ goto out;
+ }
+ *buf = (void *)p;
+
+ switch (arg) {
+ case HVFS_SYSINFO_MDSL_RAW:
+ p += sprintf(p, "MDSL RAW:\n");
+ for (i = 0; i < hro.hp_mdsl.nr; i++) {
+ p += sprintf(p, " -> %20s\t\t%ld\n", hro.hp_mdsl.hpe[i].name,
+ hro.hp_mdsl.hpe[i].value);
+ }
+ break;
+ default:
+ case HVFS_SYSINFO_MDSL_RATE:
+ p += sprintf(p, "MDSL I/O Rate:\n -> [Write ] %10.4f/s "
+ "[Read ] %10.4f/s\n",
+ g_hpmlr.write, g_hpmlr.read);
+ }
+
+out:
+ return err;
+}
View
@@ -3,7 +3,7 @@
* <macan@ncic.ac.cn>
*
* Armed with EMACS.
- * Time-stamp: <2011-04-26 17:08:29 macan>
+ * Time-stamp: <2012-05-22 17:51:22 macan>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -488,6 +488,7 @@ int root_init(void)
/* ok to run */
hro.state = HRO_STATE_RUNNING;
+ hro.uptime = time(NULL);
out_profile:
out_timers:
View
@@ -3,7 +3,7 @@
* <macan@ncic.ac.cn>
*
* Armed with EMACS.
- * Time-stamp: <2011-06-23 10:58:14 macan>
+ * Time-stamp: <2012-05-22 17:52:13 macan>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -139,6 +139,9 @@ struct hvfs_root_object
/* profile section */
struct hvfs_profile_ex hp_mds, hp_mdsl, hp_bp, hp_client;
+ /* uptime */
+ time_t uptime;
+
u8 spool_thread_stop; /* running flag for service thread */
u8 timer_thread_stop; /* running flag for timer thread */
};
@@ -170,6 +173,9 @@ struct hvfs_sys_info
#define HVFS_SYSINFO_MDS_RATE 0
#define HVFS_SYSINFO_MDS_RAW 1
+
+#define HVFS_SYSINFO_MDSL_RATE 0
+#define HVFS_SYSINFO_MDSL_RAW 1
};
/* API Region */
View
@@ -3,7 +3,7 @@
* <macan@ncic.ac.cn>
*
* Armed with EMACS.
- * Time-stamp: <2011-06-26 18:41:36 macan>
+ * Time-stamp: <2012-05-22 17:56:20 macan>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1328,6 +1328,7 @@ int root_do_info(struct xnet_msg *msg)
{
struct hvfs_sys_info *hsi;
struct xnet_msg *rpy = NULL;
+ char tbuf[32];
void *buf = NULL, *buf1 = NULL, *buf2 = NULL;
int err = 0;
@@ -1352,6 +1353,10 @@ int root_do_info(struct xnet_msg *msg)
__simply_send_reply(msg, 0);
break;
case HVFS_SYSINFO_ALL:
+ /* stick a uptime buffer */
+ snprintf(tbuf, 32, "ROOT Server Uptime %ds\n",
+ time(NULL) - hro.uptime);
+ xnet_msg_add_sdata(rpy, tbuf, strlen(tbuf));
/* fall through */
case HVFS_SYSINFO_SITE:
err = root_info_site(hsi->arg0, &buf);
@@ -1368,6 +1373,10 @@ int root_do_info(struct xnet_msg *msg)
if (hsi->cmd == HVFS_SYSINFO_MDS)
break;
case HVFS_SYSINFO_MDSL:
+ err = root_info_mdsl(hsi->arg0, &buf2);
+ if (!err && buf2) {
+ xnet_msg_add_sdata(rpy, buf2, strlen(buf2));
+ }
if (hsi->cmd == HVFS_SYSINFO_MDSL)
break;
}
View
@@ -3,7 +3,7 @@
* <macan@ncic.ac.cn>
*
* Armed with EMACS.
- * Time-stamp: <2010-11-08 22:59:06 macan>
+ * Time-stamp: <2012-05-22 11:10:41 macan>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ int main(int argc, char *argv[])
};
int err = 0;
- snprintf(dp.module, 32, "dtdefault");
+ snprintf(dp.module, 16, "dtdefault");
i.h.puuid = 900;
e.s.mdu.ctime = 10000;
err = ebpy(10, &i, &e, &hi, 10, &dt);
View
@@ -3,7 +3,7 @@
* <macan@ncic.ac.cn>
*
* Armed with EMACS.
- * Time-stamp: <2011-01-21 17:06:53 macan>
+ * Time-stamp: <2012-05-22 11:08:00 macan>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -112,7 +112,7 @@ int main(int argc, char *argv[])
/* dump now */
itb_dump(itb);
- memset(itb, sizeof(struct itb) + ITB_SIZE * sizeof(struct ite), 0);
+ memset(itb, 0, sizeof(struct itb) + ITB_SIZE * sizeof(struct ite));
}
out:
View
@@ -3,7 +3,7 @@
* <macan@ncic.ac.cn>
*
* Armed with EMACS.
- * Time-stamp: <2012-05-17 09:57:03 macan>
+ * Time-stamp: <2012-05-18 15:45:07 macan>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -141,7 +141,7 @@ int main(int argc, char *argv[])
};
int err = 0, i, j;
int self, sport = -1, mode, do_create;
- char profiling_fname[256], *root_home;
+ char profiling_fname[256], *log_home;
char *value;
char *conf_file;
struct sockaddr_in sin = {
@@ -177,22 +177,22 @@ int main(int argc, char *argv[])
} else
do_create = 0;
- value = getenv("root_home");
+ value = getenv("LOG_DIR");
if (value) {
- root_home = strdup(value);
+ log_home = strdup(value);
}
else
- root_home = NULL;
+ log_home = NULL;
st_init();
root_pre_init();
/* setup the profiling file */
- if (!root_home)
- root_home = HVFS_ROOT_HOME;
+ if (!log_home)
+ log_home = ".";
memset(profiling_fname, 0, sizeof(profiling_fname));
- sprintf(profiling_fname, "%s/CP-BACK-root.%d", root_home, self);
+ sprintf(profiling_fname, "%s/CP-BACK-root.%d", log_home, self);
hro.conf.profiling_file = strdup(profiling_fname);
hro.conf.prof_plot = ROOT_PROF_PLOT;

0 comments on commit ef1aee5

Please sign in to comment.