removed systematic printout of outgoing items which killed performance (patch from electron)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7994 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2015-03-08 08:48:00 +00:00
parent fb3d5ca9ac
commit cdf7de317d
2 changed files with 19 additions and 7 deletions

View File

@ -70,23 +70,34 @@ int pqiperson::SendItem(RsItem *i,uint32_t& serialized_size)
{
RsStackMutex stack(mPersonMtx); /**** LOCK MUTEX ****/
std::string out = "pqiperson::SendItem()";
if (active)
{
out += " Active: Sending On\n";
i->print_string(out, 5);
// every outgoing item goes through this function, so try to not waste cpu cycles
// check if debug output is wanted, to avoid unecessary work
// getZoneLevel() locks a global mutex and does a lookup in a map or returns a default value
// (not sure if this is a performance problem)
if (PQL_DEBUG_BASIC <= getZoneLevel(pqipersonzone))
{
std::string out = "pqiperson::SendItem() Active: Sending On\n";
i->print_string(out, 5); // this can be very expensive
#ifdef PERSON_DEBUG
std::cerr << out << std::endl;
#endif
pqioutput(PQL_DEBUG_BASIC, pqipersonzone, out);
}
return activepqi -> SendItem(i,serialized_size);
}
else
{
if (PQL_DEBUG_BASIC <= getZoneLevel(pqipersonzone))
{
std::string out = "pqiperson::SendItem()";
out += " Not Active: Used to put in ToGo Store\n";
out += " Now deleting...";
pqioutput(PQL_DEBUG_BASIC, pqipersonzone, out);
}
delete i;
}
pqioutput(PQL_DEBUG_BASIC, pqipersonzone, out);
return 0; // queued.
}

View File

@ -49,6 +49,7 @@ int clearDebugCrashLog();
int setDebugFile(const char *fname);
int setOutputLevel(int lvl);
int setZoneLevel(int lvl, int zone);
int getZoneLevel(int zone);
int rslog(unsigned int lvl, int zone, const std::string &msg);