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; std::vector<Endpoint::Ptr>::iterator cit;
if (!candidates.empty()) { if (!candidates.empty()) {
#ifdef _DEBUG
std::ostringstream msgbuf; std::ostringstream msgbuf;
msgbuf << "Service: " << service->GetName() << ", candidates: " << candidates.size(); msgbuf << "Service: " << service->GetName() << ", candidates: " << candidates.size();
Log(LogDebug, "delegation", msgbuf.str()); Log(LogDebug, "delegation", msgbuf.str());
#endif /* _DEBUG */
BOOST_FOREACH(const Endpoint::Ptr& candidate, candidates) { BOOST_FOREACH(const Endpoint::Ptr& candidate, candidates) {
avg_services += histogram[candidate]; avg_services += histogram[candidate];

View File

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