Skip to content

Commit 40ec79e

Browse files
committed
remove GXSPROFILING debug messages
1 parent 2f4c21e commit 40ec79e

File tree

4 files changed

+37
-7
lines changed

4 files changed

+37
-7
lines changed

src/gxs/rsdataservice.cc

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
* #define RS_DATA_SERVICE_DEBUG_CACHE 1
2727
****/
2828

29+
//#define GXSPROFILING
30+
2931
#include <fstream>
3032
#include <util/rsdir.h>
3133
#include <algorithm>
@@ -1174,16 +1176,20 @@ int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg,
11741176
int resultCount = 0;
11751177
#endif
11761178

1179+
#ifdef GXSPROFILING
11771180
// [TRACE] Start the database retrieval timer
1178-
RsDbg() << "DEBUG [DataService]: START retrieveNxsMsgs for " << reqIds.size() << " groups";
1181+
RsDbg() << "GXSPROFILING [DataService]: START retrieveNxsMsgs for " << reqIds.size() << " groups";
11791182
auto start_all = std::chrono::steady_clock::now();
1183+
#endif
11801184

11811185
for(auto mit = reqIds.begin(); mit != reqIds.end(); ++mit)
11821186
{
11831187
const RsGxsGroupId& grpId = mit->first;
11841188

1189+
#ifdef GXSPROFILING
11851190
// [TRACE] Start timer for this specific group
11861191
auto start_group = std::chrono::steady_clock::now();
1192+
#endif
11871193

11881194
// if vector empty then request all messages
11891195
const std::set<RsGxsMessageId>& msgIdV = mit->second;
@@ -1228,11 +1234,13 @@ int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg,
12281234

12291235
msg[grpId] = msgSet;
12301236

1237+
#ifdef GXSPROFILING
12311238
// [TRACE] Log time per group to monitor progress
12321239
auto end_group = std::chrono::steady_clock::now();
12331240
auto group_ms = std::chrono::duration_cast<std::chrono::milliseconds>(end_group - start_group).count();
1234-
RsDbg() << "DEBUG [DataService]: Group " << grpId.toStdString()
1241+
RsDbg() << "GXSPROFILING [DataService]: Group " << grpId.toStdString()
12351242
<< " (Total " << msgSet.size() << " msgs) processed in " << group_ms << "ms";
1243+
#endif
12361244

12371245
msgSet.clear();
12381246
}
@@ -1241,10 +1249,12 @@ int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg,
12411249
std::cerr << "RsDataService::retrieveNxsMsgs() " << mDbName << ", Requests: " << reqIds.size() << ", Results: " << resultCount << ", Time: " << timer.duration() << std::endl;
12421250
#endif
12431251

1252+
#ifdef GXSPROFILING
12441253
// [TRACE] Log total database time
12451254
auto end_all = std::chrono::steady_clock::now();
12461255
auto total_ms = std::chrono::duration_cast<std::chrono::milliseconds>(end_all - start_all).count();
1247-
RsDbg() << "DEBUG [DataService]: END retrieveNxsMsgs total time: " << total_ms << "ms";
1256+
RsDbg() << "GXSPROFILING [DataService]: END retrieveNxsMsgs total time: " << total_ms << "ms";
1257+
#endif
12481258

12491259
return 1;
12501260
}

src/gxs/rsgenexchange.cc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ static const uint32_t INTEGRITY_CHECK_PERIOD = 60*31; // 31 minutes
7373
* #define GEN_EXCH_DEBUG 1
7474
*/
7575

76+
//#define GXSPROFILING
77+
7678
#if defined(GEN_EXCH_DEBUG)
7779
static const uint32_t service_to_print = RS_SERVICE_GXS_TYPE_FORUMS;// use this to allow to this service id only, or 0 for all services
7880
// warning. Numbers should be SERVICE IDS (see serialiser/rsserviceids.h. E.g. 0x0215 for forums)
@@ -1537,8 +1539,10 @@ bool RsGenExchange::getGroupData(const uint32_t &token, std::vector<RsGxsGrpItem
15371539

15381540
bool RsGenExchange::getMsgData(uint32_t token, GxsMsgDataMap &msgItems)
15391541
{
1542+
#ifdef GXSPROFILING
15401543
// [TRACE] Start CPU/Deserialization timer
15411544
auto start_time = std::chrono::steady_clock::now();
1545+
#endif
15421546
RS_STACK_MUTEX(mGenMtx) ;
15431547
NxsMsgDataResult msgResult;
15441548
bool ok = mDataAccess->getMsgData(token, msgResult);
@@ -1598,13 +1602,17 @@ bool RsGenExchange::getMsgData(uint32_t token, GxsMsgDataMap &msgItems)
15981602
}
15991603
}
16001604
// [TRACE] Log the number of items processed
1601-
RsDbg() << "DEBUG [GenExch]: Deserialized " << count << " items";
1605+
#ifdef GXSPROFILING
1606+
RsDbg() << "GXSPROFILING [GenExch]: Deserialized " << count << " items";
1607+
#endif
16021608
}
16031609

1610+
#ifdef GXSPROFILING
16041611
// [TRACE] End timer and log total processing time
16051612
auto end_time = std::chrono::steady_clock::now();
16061613
auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time - start_time).count();
1607-
RsDbg() << "DEBUG [GenExch]: getMsgData (Token: " << token << ") total time: " << elapsed << "ms";
1614+
RsDbg() << "GXSPROFILING [GenExch]: getMsgData (Token: " << token << ") total time: " << elapsed << "ms";
1615+
#endif
16081616

16091617
return ok;
16101618
}

src/gxs/rsgxsnetservice.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@
288288

289289
//#define NXS_FRAG
290290

291+
//#define GXSPROFILING
292+
291293
// The constant below have a direct influence on how fast forums/channels/posted/identity groups propagate and on the overloading of queues:
292294
//
293295
// Channels/forums will update at a rate of SYNC_PERIOD*MAX_REQLIST_SIZE/60 messages per minute.
@@ -3515,8 +3517,10 @@ void RsGxsNetService::runVetting()
35153517

35163518
void RsGxsNetService::locked_genSendMsgsTransaction(NxsTransaction* tr)
35173519
{
3520+
#ifdef GXSPROFILING
35183521
// [TRACE] Start global timer for the network transaction
35193522
auto start_net = std::chrono::steady_clock::now();
3523+
#endif
35203524

35213525
#ifdef NXS_NET_DEBUG_0
35223526
GXSNETDEBUG_P_(tr->mTransaction->PeerId()) << "locked_genSendMsgsTransaction() Generating Msg data send fron TransN: " << tr->mTransaction->transactionNumber << std::endl;
@@ -3705,10 +3709,12 @@ void RsGxsNetService::locked_genSendMsgsTransaction(NxsTransaction* tr)
37053709
delete newTr;
37063710
}
37073711

3712+
#ifdef GXSPROFILING
37083713
// [TRACE] End global timer and log with the exact same format as V3
37093714
auto end_net = std::chrono::steady_clock::now();
37103715
auto net_ms = std::chrono::duration_cast<std::chrono::milliseconds>(end_net - start_net).count();
3711-
RsDbg() << "DEBUG [NetService]: TOTAL locked_genSendMsgsTransaction for " << tr->mItems.size() << " items took " << net_ms << "ms";
3716+
RsDbg() << "GXSPROFILING [NetService]: TOTAL locked_genSendMsgsTransaction for " << tr->mItems.size() << " items took " << net_ms << "ms";
3717+
#endif
37123718

37133719
return;
37143720
}

src/util/retrodb.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535

3636
//#define RETRODB_DEBUG
3737

38+
//#define GXSPROFILING
39+
3840
const int RetroDb::OPEN_READONLY = SQLITE_OPEN_READONLY;
3941
const int RetroDb::OPEN_READWRITE = SQLITE_OPEN_READWRITE;
4042
const int RetroDb::OPEN_READWRITE_CREATE = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
@@ -241,8 +243,10 @@ bool RetroDb::execSQL(const std::string &query){
241243
RetroCursor* RetroDb::sqlQuery(const std::string& tableName, const std::list<std::string>& columns,
242244
const std::string& selection, const std::string& orderBy){
243245

246+
#ifdef GXSPROFILING
244247
// [TRACE] Start individual query timer
245248
auto start_sql = std::chrono::steady_clock::now();
249+
#endif
246250

247251
if(tableName.empty() || columns.empty()){
248252
std::cerr << "RetroDb::sqlQuery(): No table or columns given" << std::endl;
@@ -284,11 +288,13 @@ RetroCursor* RetroDb::sqlQuery(const std::string& tableName, const std::list<std
284288
sqlite3_prepare_v2(mDb, sqlQuery.c_str(), sqlQuery.length(), &stmt, NULL);
285289
RetroCursor* cursor = new RetroCursor(stmt);
286290

291+
#ifdef GXSPROFILING
287292
// [TRACE] End timer and log using the same "Batch SQL" tag for direct comparison
288293
auto end_sql = std::chrono::steady_clock::now();
289294
auto sql_ms = std::chrono::duration_cast<std::chrono::milliseconds>(end_sql - start_sql).count();
290295

291-
//RsDbg() << "DEBUG [RetroDb]: Batch SQL for group individual_query took " << sql_ms << "ms";
296+
RsDbg() << "GXSPROFILING [RetroDb]: Batch SQL for group individual_query took " << sql_ms << "ms";
297+
#endif
292298

293299
return cursor;
294300
}

0 commit comments

Comments
 (0)