summaryrefslogtreecommitdiff
path: root/src/ServerStatMan.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-08-10 15:22:55 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-08-10 15:22:55 +0000
commitdb46bab38ba1b9e96949ba8cd1ffaa59fe14ef34 (patch)
tree46a41a2c3cfd29263cd159edd9c65e711a0722df /src/ServerStatMan.cc
parent6aba376430b45979a420cfe8fd0f8d6a3025f581 (diff)
2008-08-11 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added options to load/save the server's performance/status to a file and the timeout to drop their data. --server-stat-of=FILE specifies the file to which performance data is saved. --server-stat-if=FILE specifies the file to read previously saved by --server-stat-of option. Might be used with --uri-selector=feedback. --server-stat-timeout=TIMEOUT specifies timeout to invalidate the data. TIMEOUT is specified in seconds and the default value is 24hours. * src/MultiUrlRequestInfo.cc * src/OptionHandlerFactory.cc * src/RequestGroupMan.cc * src/RequestGroupMan.h * src/ServerStatMan.cc * src/ServerStatMan.h * src/option_processing.cc * src/prefs.cc * src/prefs.h * test/ServerStatManTest.cc
Diffstat (limited to 'src/ServerStatMan.cc')
-rw-r--r--src/ServerStatMan.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ServerStatMan.cc b/src/ServerStatMan.cc
index 7f671fdf..464e228c 100644
--- a/src/ServerStatMan.cc
+++ b/src/ServerStatMan.cc
@@ -74,13 +74,14 @@ bool ServerStatMan::add(const SharedHandle<ServerStat>& serverStat)
}
}
-void ServerStatMan::save(std::ostream& out) const
+bool ServerStatMan::save(std::ostream& out) const
{
std::copy(_serverStats.begin(), _serverStats.end(),
std::ostream_iterator<SharedHandle<ServerStat> >(out, "\n"));
+ return !out.bad();
}
-void ServerStatMan::load(std::istream& in)
+bool ServerStatMan::load(std::istream& in)
{
static const std::string S_HOST = "host";
static const std::string S_PROTOCOL = "protocol";
@@ -117,6 +118,7 @@ void ServerStatMan::load(std::istream& in)
continue;
}
}
+ return !in.bad();
}
class FindStaleServerStat {