You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2012/06/15 01:02:48 UTC
git commit: updated some formating and added an ignore file for tstop
Updated Branches:
refs/heads/master f41885f6e -> 3dce70966
updated some formating and added an ignore file for tstop
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/3dce7096
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/3dce7096
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/3dce7096
Branch: refs/heads/master
Commit: 3dce709666f0fc456c9e86845c10bc871371204c
Parents: f41885f
Author: Bryan Call <bc...@apache.org>
Authored: Thu Jun 14 16:02:19 2012 -0700
Committer: Bryan Call <bc...@apache.org>
Committed: Thu Jun 14 16:02:19 2012 -0700
----------------------------------------------------------------------
contrib/tstop/.gitignore | 1 +
contrib/tstop/stats.h | 21 ++++++++++++++-------
contrib/tstop/tstop.cc | 10 +++++++---
3 files changed, 22 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3dce7096/contrib/tstop/.gitignore
----------------------------------------------------------------------
diff --git a/contrib/tstop/.gitignore b/contrib/tstop/.gitignore
new file mode 100644
index 0000000..c518e71
--- /dev/null
+++ b/contrib/tstop/.gitignore
@@ -0,0 +1 @@
+tstop
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3dce7096/contrib/tstop/stats.h
----------------------------------------------------------------------
diff --git a/contrib/tstop/stats.h b/contrib/tstop/stats.h
index 61f2a1a..914b01f 100644
--- a/contrib/tstop/stats.h
+++ b/contrib/tstop/stats.h
@@ -181,13 +181,20 @@ public:
const LookupItem &item = lookup_it->second;
if (item.type == 1 || item.type == 2 || item.type == 5 || item.type == 8) {
- assert(TSRecordGetInt(item.name, &value) == TS_ERR_OKAY);
- //cerr << "name" << item.name << " value: " << value << endl;
- string key = item.name;
- char buffer[32];
- sprintf(buffer, "%lld", value);
- string foo = buffer;
- (*_stats)[key] = foo;
+ if (strcmp(item.pretty, "Version") == 0) {
+ // special case for Version informaion
+ TSString strValue = NULL;
+ assert(TSRecordGetString(item.name, &strValue) == TS_ERR_OKAY);
+ string key = item.name;
+ (*_stats)[key] = strValue;
+ } else {
+ assert(TSRecordGetInt(item.name, &value) == TS_ERR_OKAY);
+ string key = item.name;
+ char buffer[32];
+ sprintf(buffer, "%lld", value);
+ string foo = buffer;
+ (*_stats)[key] = foo;
+ }
}
}
_old_time = _now;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3dce7096/contrib/tstop/tstop.cc
----------------------------------------------------------------------
diff --git a/contrib/tstop/tstop.cc b/contrib/tstop/tstop.cc
index 2a680ce..6d3869d 100644
--- a/contrib/tstop/tstop.cc
+++ b/contrib/tstop/tstop.cc
@@ -212,8 +212,12 @@ int main(int argc, char **argv)
}
Stats stats(host);
- //cout << response;
- //return 1;
+ if (host == "") {
+ char hostname[25];
+ hostname[sizeof(hostname) - 1] = '\0';
+ gethostname(hostname, sizeof(hostname) - 1);
+ host = hostname;
+ }
initscr();
curs_set(0);
@@ -247,7 +251,7 @@ int main(int argc, char **argv)
mvprintw(0, 40, " CLIENT REQUEST & RESPONSE ");
mvprintw(16, 0, " CLIENT ");
mvprintw(16, 40, " ORIGIN SERVER ");
- mvprintw(23, 0, "%s - %.12s - %.12s (q)uit (h)elp (%c)bsolute ", timeBuf, version.c_str(), host.c_str(), absolute ? 'A' : 'a');
+ mvprintw(23, 0, "%8.8s - %-10.10s - %-24.24s (q)uit (h)elp (%c)bsolute ", timeBuf, version.c_str(), host.c_str(), absolute ? 'A' : 'a');
attroff(COLOR_PAIR(colorPair::border));
attroff(A_BOLD);