MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / update

Method update

dds/DCPS/ThreadStatusManager.cpp:38–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36{}
37
38void ThreadStatusManager::Thread::update(const MonotonicTimePoint& m_now,
39 const SystemTimePoint& s_now,
40 ThreadStatus next_status,
41 const TimeDuration& bucket_limit,
42 bool nested, int detail1, int detail2)
43{
44 timestamp_ = s_now;
45
46 if (nested) {
47 (next_status == ThreadStatus_Active) ? ++nesting_depth_ : --nesting_depth_;
48 }
49
50 if (!nested ||
51 (next_status == ThreadStatus_Active && nesting_depth_ == 1) ||
52 (next_status == ThreadStatus_Idle && nesting_depth_ == 0)) {
53 if (buckets_[current_bucket_].total_time() > bucket_limit) {
54 current_bucket_ = (current_bucket_ + 1) % BUCKET_COUNT;
55 Bucket& current = buckets_[current_bucket_];
56 total_.active_time -= current.active_time;
57 current.active_time = 0;
58 total_.idle_time -= current.idle_time;
59 current.idle_time = 0;
60 }
61
62 const TimeDuration t = m_now - last_update_;
63
64 switch (status_) {
65 case ThreadStatus_Active:
66 buckets_[current_bucket_].active_time += t;
67 total_.active_time += t;
68 break;
69 case ThreadStatus_Idle:
70 buckets_[current_bucket_].idle_time += t;
71 total_.idle_time += t;
72 break;
73 }
74
75 last_status_change_ = m_now;
76 status_ = next_status;
77 }
78 detail1_ = detail1;
79 detail2_ = detail2;
80 last_update_ = m_now;
81}
82
83namespace {
84 TimeDuration bonus_time(const MonotonicTimePoint& now, const MonotonicTimePoint& last_change,

Callers 2

update_iMethod · 0.45
update_topic_qosMethod · 0.45

Calls 8

update_thread_statusMethod · 0.80
pop_frontMethod · 0.80
findMethod · 0.45
endMethod · 0.45
on_thread_finishedMethod · 0.45
eraseMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected