ndt-dev - [ndt-dev] [ndt] r997 committed - Make tcp_stats_snap_read_var work like tcp_stats_read_var
Subject: NDT-DEV email list created
List archive
[ndt-dev] [ndt] r997 committed - Make tcp_stats_snap_read_var work like tcp_stats_read_var
Chronological Thread
- From:
- To:
- Subject: [ndt-dev] [ndt] r997 committed - Make tcp_stats_snap_read_var work like tcp_stats_read_var
- Date: Mon, 10 Mar 2014 13:48:35 +0000
Revision: 997
Author:
Date: Mon Mar 10 13:47:12 2014 UTC
Log: Make tcp_stats_snap_read_var work like tcp_stats_read_var
http://code.google.com/p/ndt/source/detail?r=997
Modified:
/branches/aaron-tcp_stats_cleanup/src/testoptions.c
/branches/aaron-tcp_stats_cleanup/src/web100-util.c
/branches/aaron-tcp_stats_cleanup/src/web100srv.h
=======================================
--- /branches/aaron-tcp_stats_cleanup/src/testoptions.c Mon Mar 10 13:43:13 2014 UTC
+++ /branches/aaron-tcp_stats_cleanup/src/testoptions.c Mon Mar 10 13:47:12 2014 UTC
@@ -48,8 +48,11 @@
void findCwndPeaks(tcp_stat_agent* agent, CwndPeaks* peaks,
tcp_stat_snap* snap) {
int CurCwnd;
+ char buf[128];
- CurCwnd = tcp_stats_snap_read_var(agent, snap, "CurCwnd");
+ tcp_stats_snap_read_var(agent, snap, "CurCwnd", buf, sizeof(buf));
+
+ CurCwnd = atoi(buf);
if (slowStart) {
if (CurCwnd < prevCWNDval) {
=======================================
--- /branches/aaron-tcp_stats_cleanup/src/web100-util.c Mon Mar 10 13:46:44 2014 UTC
+++ /branches/aaron-tcp_stats_cleanup/src/web100-util.c Mon Mar 10 13:47:12 2014 UTC
@@ -242,11 +242,11 @@
strlcat(results, line, results_strlen);
// get web100 values for the middlebox test result group
- tcp_stats_read_var_str(agent, cn, "CurMSS", buff, sizeof(buff));
+ tcp_stats_read_var(agent, cn, "CurMSS", buff, sizeof(buff));
currentMSSval = atoi(buff);
for (i = 0; i < sizeof(vars) / sizeof(vars[0]); i++) {
- if (tcp_stats_read_var_str(agent, cn, vars[i], buff, sizeof(buff)) != 0) {
+ if (tcp_stats_read_var(agent, cn, vars[i], buff, sizeof(buff)) != 0) {
log_println(0, "Middlebox: Failed to read the value of %s", vars[i]);
return;
}
@@ -1016,7 +1016,7 @@
return (0);
}
-int tcp_stats_read_var_str(tcp_stat_agent *agent, tcp_stat_connection conn, const char *var_name, char *buf, int bufsize) {
+int tcp_stats_read_var(tcp_stat_agent *agent, tcp_stat_connection conn, const char *var_name, char *buf, int bufsize) {
#ifdef USE_WEB100
web100_group *group;
web100_var* var;
@@ -1041,12 +1041,10 @@
snprintf(buf, bufsize, "%u", value.uv32);
#endif
- log_println( 0, "Read %s: %s", var_name, buf);
-
return 0;
}
-int tcp_stats_snap_read_var(tcp_stat_agent *agent, tcp_stat_snap *snap, const char *var_name) {
+int tcp_stats_snap_read_var(tcp_stat_agent *agent, tcp_stat_snap *snap, const char *var_name, char *buf, int bufsize) {
#if USE_WEB100
web100_group* group;
web100_var* var;
@@ -1054,13 +1052,14 @@
web100_agent_find_var_and_group(agent, var_name, &group, &var);
web100_snap_read(var, snap, tmpstr);
- return atoi(web100_value_to_text(web100_get_var_type(var), tmpstr));
+ snprintf(buf, bufsize, "%s", web100_value_to_text(web100_get_var_type(var), tmpstr));
#elif USE_WEB10G
struct estats_val value;
web10g_find_val(snap, var_name, &value);
- return value.uv32;
+ sprintf(buf, bufsize, "%u", value.uv32);
#endif
+ return 0;
}
tcp_stat_connection tcp_stats_connection_from_socket(tcp_stat_agent *agent, int sock) {
=======================================
--- /branches/aaron-tcp_stats_cleanup/src/web100srv.h Mon Mar 10 13:46:44 2014 UTC
+++ /branches/aaron-tcp_stats_cleanup/src/web100srv.h Mon Mar 10 13:47:12 2014 UTC
@@ -309,7 +309,7 @@
int tcp_stats_init(char *VarFileName);
tcp_stat_agent *tcp_stats_init_agent();
void tcp_stats_free_agent(tcp_stat_agent *agent);
-int tcp_stats_snap_read_var(tcp_stat_agent *agent, tcp_stat_snap *snap, const char *var_name);
+int tcp_stats_snap_read_var(tcp_stat_agent *agent, tcp_stat_snap *snap, const char *var_name, char *buf, int bufsize);
void tcp_stats_set_cwnd(tcp_stat_agent *agent, tcp_stat_connection cn, uint32_t cwnd);
tcp_stat_connection tcp_stats_connection_from_socket(tcp_stat_agent *agent, int sock);
@@ -325,7 +325,7 @@
void tcp_stats_set_cwnd_limit(tcp_stat_agent *agent, tcp_stat_connection conn, tcp_stat_group* group, uint32_t limit);
-int tcp_stats_read_var_str(tcp_stat_agent *agent, tcp_stat_connection conn, const char *var_name, char *buf, int bufsize);
+int tcp_stats_read_var(tcp_stat_agent *agent, tcp_stat_connection conn, const char *var_name, char *buf, int bufsize);
int tcp_stat_autotune(int sock, tcp_stat_agent* agent, tcp_stat_connection cn);
void tcp_stat_middlebox(int sock, tcp_stat_agent* agent, tcp_stat_connection cn,
- [ndt-dev] [ndt] r997 committed - Make tcp_stats_snap_read_var work like tcp_stats_read_var, ndt, 03/10/2014
Archive powered by MHonArc 2.6.16.