mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-27 15:44:11 +02:00
Minor performance tweaks.
This commit is contained in:
parent
1375c64ad9
commit
2e051ad9e2
@ -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];
|
||||||
|
@ -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)
|
||||||
|
break;
|
||||||
|
|
||||||
if (rc > 0) {
|
|
||||||
outputStream.write(buffer, rc);
|
outputStream.write(buffer, rc);
|
||||||
}
|
}
|
||||||
} while (rc > 0);
|
|
||||||
|
|
||||||
String output = outputStream.str();
|
String output = outputStream.str();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user