Minor performance tweaks.

This commit is contained in:
Gunnar Beutner 2013-03-27 18:02:51 +00:00
parent 1375c64ad9
commit 2e051ad9e2
2 changed files with 9 additions and 7 deletions

View File

@ -127,9 +127,11 @@ void DelegationComponent::DelegationTimerHandler(void)
std::vector<Endpoint::Ptr>::iterator cit;
if (!candidates.empty()) {
#ifdef _DEBUG
std::ostringstream msgbuf;
msgbuf << "Service: " << service->GetName() << ", candidates: " << candidates.size();
Log(LogDebug, "delegation", msgbuf.str());
#endif /* _DEBUG */
BOOST_FOREACH(const Endpoint::Ptr& candidate, candidates) {
avg_services += histogram[candidate];

View File

@ -155,17 +155,17 @@ ProcessResult Process::Run(void)
(void) close(fds[1]);
char buffer[512];
int rc;
std::ostringstream outputStream;
do {
rc = read(fd, buffer, sizeof(buffer));
for (;;) {
int rc = read(fd, buffer, sizeof(buffer));
if (rc > 0) {
outputStream.write(buffer, rc);
}
} while (rc > 0);
if (rc <= 0)
break;
outputStream.write(buffer, rc);
}
String output = outputStream.str();