File tree Expand file tree Collapse file tree 3 files changed +53
-1
lines changed Expand file tree Collapse file tree 3 files changed +53
-1
lines changed Original file line number Diff line number Diff line change @@ -163,5 +163,50 @@ EntityDBTask* Buffered_DBTasks::tryGetNextTask(EntityDBTask* pTask)
163
163
return pNextTask;
164
164
}
165
165
166
+ // -------------------------------------------------------------------------------------
167
+ std::string Buffered_DBTasks::printBuffered_dbid ()
168
+ {
169
+ std::string ret;
170
+ mutex_.lockMutex ();
171
+
172
+ for (DBID_TASKS_MAP::iterator iter = dbid_tasks_.begin (); iter != dbid_tasks_.end (); iter = dbid_tasks_.upper_bound (iter->first ))
173
+ {
174
+ std::pair<DBID_TASKS_MAP::iterator, DBID_TASKS_MAP::iterator> res = dbid_tasks_.equal_range (iter->first );
175
+ int count = 0 ;
176
+
177
+ for (DBID_TASKS_MAP::iterator i = res.first ; i != res.second ; ++i)
178
+ {
179
+ ++count;
180
+ }
181
+
182
+ ret += (boost::format (" %1%:%2%, " ) % iter->first % count).str ();
183
+ }
184
+
185
+ mutex_.unlockMutex ();
186
+ return ret;
187
+ }
188
+
189
+ // -------------------------------------------------------------------------------------
190
+ std::string Buffered_DBTasks::printBuffered_entityID ()
191
+ {
192
+ std::string ret;
193
+ mutex_.lockMutex ();
194
+
195
+ for (ENTITYID_TASKS_MAP::iterator iter = entityid_tasks_.begin (); iter != entityid_tasks_.end (); iter = entityid_tasks_.upper_bound (iter->first ))
196
+ {
197
+ int count = 0 ;
198
+ std::pair<ENTITYID_TASKS_MAP::iterator, ENTITYID_TASKS_MAP::iterator> res = entityid_tasks_.equal_range (iter->first );
199
+ for (ENTITYID_TASKS_MAP::iterator i = res.first ; i != res.second ; ++i)
200
+ {
201
+ ++count;
202
+ }
203
+
204
+ ret += (boost::format (" %1%:%2%, " ) % iter->first % count).str ();
205
+ }
206
+
207
+ mutex_.unlockMutex ();
208
+ return ret;
209
+ }
210
+
166
211
// -------------------------------------------------------------------------------------
167
212
}
Original file line number Diff line number Diff line change @@ -72,6 +72,11 @@ class Buffered_DBTasks
72
72
return ret;
73
73
}
74
74
75
+ /* *
76
+ 提供给watcher使用
77
+ */
78
+ std::string printBuffered_dbid ();
79
+ std::string printBuffered_entityID ();
75
80
protected:
76
81
bool hasTask_ (DBID dbid);
77
82
bool hasTask_ (ENTITY_ID entityID);
Original file line number Diff line number Diff line change @@ -107,7 +107,9 @@ bool Dbmgr::initializeWatcher()
107
107
108
108
WATCH_OBJECT (" DBThreadPool/dbid_tasksSize" , &bufferedDBTasks_, &Buffered_DBTasks::dbid_tasksSize);
109
109
WATCH_OBJECT (" DBThreadPool/entityid_tasksSize" , &bufferedDBTasks_, &Buffered_DBTasks::entityid_tasksSize);
110
-
110
+ WATCH_OBJECT (" DBThreadPool/printBuffered_dbid" , &bufferedDBTasks_, &Buffered_DBTasks::printBuffered_dbid);
111
+ WATCH_OBJECT (" DBThreadPool/printBuffered_entityID" , &bufferedDBTasks_, &Buffered_DBTasks::printBuffered_entityID);
112
+
111
113
return ServerApp::initializeWatcher () && DBUtil::pThreadPool ()->initializeWatcher ();
112
114
}
113
115
You can’t perform that action at this time.
0 commit comments