OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
agent_profile.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #include <boost/uuid/uuid_io.hpp>
6 #include <boost/date_time/posix_time/posix_time.hpp>
7 #include <boost/date_time/posix_time/posix_time_io.hpp>
8 
9 #include <vnc_cfg_types.h>
10 #include <base/util.h>
11 
12 #include <oper/agent_profile_types.h>
13 
14 #include <cmn/agent_cmn.h>
15 #include <cfg/cfg_init.h>
16 #include <oper/operdb_init.h>
17 #include <oper/agent_profile.h>
18 
19 #include <oper/interface_common.h>
20 #include <oper/vn.h>
21 #include <oper/vm.h>
22 #include <oper/vrf.h>
23 #include <filter/acl.h>
24 #include "db/db.h"
25 
26 using namespace std;
27 
28 AgentProfile::AgentProfile(Agent *agent, bool enable) :
29  agent_(agent), timer_(NULL), enable_(enable) {
30 
33  (*(agent_->event_manager())->io_service(), "Agent Profile",
34  task->GetTaskId("Agent::Profile"), 0);
35  time(&start_time_);
36 }
37 
40 }
41 
43  timer_->Cancel();
44 }
45 
47  if (enable_) {
49  this));
50  }
51 }
52 
55  data->Get(agent_);
56  if (pkt_flow_stats_cb_.empty() == false) {
57  pkt_flow_stats_cb_(data);
58  }
59  if (ksync_stats_cb_.empty() == false) {
60  ksync_stats_cb_(data);
61  }
62  if (flow_stats_cb_.empty() == false) {
63  flow_stats_cb_(data);
64  }
65  Log();
66  return true;
67 }
68 
69 string GetProfileString(DBTable *table, const char *name) {
70  stringstream str;
71  str << setw(16) << name
72  << " Size " << setw(6) << table->Size()
73  << " Enqueue " << setw(6) << table->enqueue_count()
74  << " Input " << setw(6) << table->input_count()
75  << " Notify " << setw(6) << table->notify_count();
76  return str.str();
77 }
78 
80 }
81 
85  return &seconds_history_data_[index];
86 }
87 
89  return &seconds_history_data_[index];
90 }
92 // ProfileData collection routines
95  db_entry_count_ = 0;
96  walker_count_ = 0;
97  enqueue_count_ = 0;
98  input_count_ = 0;
99  notify_count_ = 0;
100 }
101 
103  db_entry_count_ = table->Size();
104  walker_count_ = table->walker_count();
105  enqueue_count_ = table->enqueue_count();
106  input_count_ = table->input_count();
107  notify_count_ = table->notify_count();
108 }
109 
111  db_entry_count_ += table->Size();
112  walker_count_ += table->walker_count();
113  enqueue_count_ += table->enqueue_count();
114  input_count_ += table->input_count();
115  notify_count_ += table->notify_count();
116 }
117 
119  queue_count_ = 0;
120  enqueue_count_ = 0;
121  dequeue_count_ = 0;
122  max_queue_count_ = 0;
123  start_count_ = 0;
124  busy_time_ = 0;
125 }
126 
128  add_tokens_ = 0;
129  add_failures_ = 0;
130  add_restarts_ = 0;
131  ksync_tokens_ = 0;
132  ksync_failures_ = 0;
133  ksync_restarts_ = 0;
134  update_tokens_ = 0;
135  update_failures_ = 0;
136  update_restarts_ = 0;
137  del_tokens_ = 0;
138  del_failures_ = 0;
139  del_restarts_ = 0;
140 }
141 
143  flow_count_ = 0;
144  add_count_ = 0;
145  del_count_= 0;
146  audit_count_ = 0;
147  reval_count_ = 0;
148  recompute_count_ = 0;
149  pkt_handler_queue_.Reset();
150  flow_mgmt_queue_.Reset();
151  flow_update_queue_.Reset();
152  for (uint16_t i = 0; i < flow_event_queue_.size(); i++) {
153  flow_event_queue_[i].Reset();
154  }
155  for (uint16_t i = 0; i < flow_tokenless_queue_.size(); i++) {
156  flow_tokenless_queue_[i].Reset();
157  }
158  for (uint16_t i = 0; i < flow_delete_queue_.size(); i++) {
159  flow_delete_queue_[i].Reset();
160  }
161 
162  for (uint16_t i = 0; i < flow_ksync_queue_.size(); i++) {
163  flow_ksync_queue_[i].Reset();
164  }
165 
166  for (uint16_t i = 0; i < flow_stats_queue_.size(); i++) {
167  flow_stats_queue_[i].Reset();
168  }
169  token_stats_.Reset();
170 }
171 
173  arp_count_ = 0;
174  dhcp_count_ = 0;
175  dns_count_ = 0;
176  icmp_count_ = 0;
177 }
179  inet4_add_count_ = 0;
180  inet4_del_count_ = 0;
181  inet6_add_count_ = 0;
182  inet6_del_count_ = 0;
183  mcast_add_count_ = 0;
184  mcast_del_count_ = 0;
185  bridge_add_count_ = 0;
186  bridge_del_count_ = 0;
187 }
188 
190  flow_.Reset();
191  pkt_.Reset();
197  rx_stats_.Reset();
198  tx_stats_.Reset();
201 }
202 
203 void ProfileData::Get(Agent *agent) {
204  std::ostringstream str;
205  str << boost::posix_time::second_clock::local_time();
206  time_ = str.str();
207  DB::TableMap::const_iterator itr =
208  agent->db()->const_begin();
209  DB::TableMap::const_iterator itrend =
210  agent->db()->const_end();
211 
212  profile_stats_table_.clear();
213  for ( ;itr != itrend; ++itr) {
214  if(itr->first.rfind(kV4UnicastRouteDbTableSuffix) !=
215  std::string::npos) {
216  inet4_routes_.Accumulate(itr->second);
217  } else if (itr->first.rfind(kV6UnicastRouteDbTableSuffix) !=
218  std::string::npos) {
219  inet6_routes_.Accumulate(itr->second);
220  } else if (itr->first.rfind(kL2RouteDbTableSuffix) !=
221  std::string::npos) {
222  bridge_routes_.Accumulate(itr->second);
223  } else if (itr->first.rfind(kMcastRouteDbTableSuffix) !=
224  std::string::npos) {
225  multicast_routes_.Accumulate(itr->second);
226  } else if (itr->first.rfind(kEvpnRouteDbTableSuffix) !=
227  std::string::npos) {
228  evpn_routes_.Accumulate(itr->second);
229  } else {
231  stats.Get(dynamic_cast<DBTable*>(itr->second));
232  profile_stats_table_.insert(make_pair(itr->first,stats));
233  }
234  }
235 
237  task_stats_[2] = *sched->GetTaskGroupStats(2);
238  task_stats_[1] = *sched->GetTaskGroupStats(1);
239  task_stats_[4] = *sched->GetTaskGroupStats(4);
240  task_stats_[6] = *sched->GetTaskGroupStats(6);
241  task_stats_[9] = *sched->GetTaskGroupStats(9);
242  task_stats_[5] = *sched->GetTaskGroupStats(5);
243  task_stats_[11] = *sched->GetTaskGroupStats(11);
244  task_stats_[8] = *sched->GetTaskGroupStats(8);
245 }
246 
248 // Sandesh ProfileData routines
250 static void DBStatsToSandesh(SandeshDBTableStats *stats, const string &table,
251  const ProfileData::DBTableStats &db_stats) {
252  stats->set_table(table);
253  stats->set_db_entry_count(db_stats.db_entry_count_);
254  stats->set_input_count(db_stats.input_count_);
255  stats->set_walker_count(db_stats.walker_count_);
256  stats->set_enqueue_count(db_stats.enqueue_count_);
257  stats->set_notify_count(db_stats.notify_count_);
258 }
259 
260 static void GetDBTableStats(SandeshDBTableStatsInfo *stats, int index,
261  ProfileData *data) {
262  stats->set_index(index);
263  stats->set_time_str(data->time_);
264  std::vector<SandeshDBTableStats> db_stats_list;
265  SandeshDBTableStats db_stats;
266  std::map<std::string, ProfileData::DBTableStats >::iterator itr =
267  data->profile_stats_table_.begin();
268 
269  DBStatsToSandesh(&db_stats, "Ipv4 Unicast route", data->inet4_routes_);
270  db_stats_list.push_back(db_stats);
271  DBStatsToSandesh(&db_stats, "Ipv6 Unicast route", data->inet6_routes_);
272  db_stats_list.push_back(db_stats);
273  DBStatsToSandesh(&db_stats, "Multicast route", data->multicast_routes_);
274  db_stats_list.push_back(db_stats);
275  DBStatsToSandesh(&db_stats, "Evpn route", data->evpn_routes_);
276  db_stats_list.push_back(db_stats);
277  DBStatsToSandesh(&db_stats, "Bridge", data->bridge_routes_);
278  db_stats_list.push_back(db_stats);
279  while (itr != data->profile_stats_table_.end()) {
280  if(itr->first.find(kInterfaceDbTablePrefix) != std::string::npos) {
281  DBStatsToSandesh(&db_stats, "Interface", itr->second);
282  db_stats_list.push_back(db_stats);
283  } else if (itr->first.find(kMplsDbTablePrefix) != std::string::npos) {
284  DBStatsToSandesh(&db_stats, "Mpls", itr->second);
285  db_stats_list.push_back(db_stats);
286  } else if (itr->first.find(kVnDbTablePrefix) != std::string::npos) {
287  DBStatsToSandesh(&db_stats, "Vn", itr->second);
288  db_stats_list.push_back(db_stats);
289  } else if (itr->first.find(kVmDbTablePrefix) != std::string::npos) {
290  DBStatsToSandesh(&db_stats, "Vm", itr->second);
291  db_stats_list.push_back(db_stats);
292  } else if (itr->first.find(kVrfDbTablePrefix) != std::string::npos) {
293  DBStatsToSandesh(&db_stats, "Vrf", itr->second);
294  db_stats_list.push_back(db_stats);
295  } else if (itr->first.find(kAclDbTablePrefix) != std::string::npos) {
296  DBStatsToSandesh(&db_stats, "Acl", itr->second);
297  db_stats_list.push_back(db_stats);
298  }
299  ++itr;
300  }
301  stats->set_stats(db_stats_list);
302 }
303 
304 void SandeshDBTableStatsRequest::HandleRequest() const {
305  SandeshDBTableStatsList *resp = new SandeshDBTableStatsList();
306  resp->set_context(context());
307 
308  Agent *agent = Agent::GetInstance();
309  AgentProfile *profile = agent->oper_db()->agent_profile();
310  uint16_t end = profile->seconds_history_index();
311  uint16_t start = 0;
314 
315  std::vector<SandeshDBTableStatsInfo> stats_list;
316  for (uint16_t i = start; i < end; i++) {
317  uint16_t index = i % AgentProfile::kSecondsHistoryCount;
318  ProfileData *data = profile->GetProfileData(index);
319  SandeshDBTableStatsInfo stats;
320  GetDBTableStats(&stats, index, data);
321  stats_list.push_back(stats);
322  }
323  resp->set_stats(stats_list);
324 
325  resp->Response();
326 }
327 
328 static void GetFlowStats(SandeshFlowStats *stats, int index,
329  ProfileData *data) {
330  stats->set_index(index);
331  stats->set_time_str(data->time_);
332  stats->set_flow_count(data->flow_.flow_count_);
333  stats->set_add_count(data->flow_.add_count_);
334  stats->set_del_count(data->flow_.del_count_);
335  stats->set_reval_count(data->flow_.reval_count_);
336  stats->set_recompute_count(data->flow_.recompute_count_);
337  stats->set_audit_count(data->flow_.audit_count_);
338  stats->set_vrouter_responses(data->flow_.vrouter_responses_);
339  stats->set_vrouter_error(data->flow_.vrouter_error_);
340 }
341 
342 void SandeshFlowStatsRequest::HandleRequest() const {
343  SandeshFlowStatsList *resp = new SandeshFlowStatsList();
344  resp->set_context(context());
345 
346  Agent *agent = Agent::GetInstance();
347  AgentProfile *profile = agent->oper_db()->agent_profile();
348  uint16_t end = profile->seconds_history_index();
349  uint16_t start = 0;
350  if (end > AgentProfile::kSecondsHistoryCount)
352 
353  std::vector<SandeshFlowStats> stats_list;
354  for (uint16_t i = start; i < end; i++) {
355  uint16_t index = i % AgentProfile::kSecondsHistoryCount;
356  ProfileData *data = profile->GetProfileData(index);
357  SandeshFlowStats stats;
358  GetFlowStats(&stats, index, data);
359  stats_list.push_back(stats);
360  }
361  resp->set_stats(stats_list);
362  resp->Response();
363 }
364 
365 static void GetTaskStats(TaskProfileStats *stats, int index,
366  ProfileData *data) {
367  stats->set_index(index);
368 
369  TaskStats *task_stats = NULL;
370  // Flow Handler
371  task_stats = &data->task_stats_[2];
372  stats->set_flow_wait(task_stats->wait_count_);
373  stats->set_flow_run(task_stats->enqueue_count_);
374  stats->set_flow_defer(task_stats->defer_count_);
375 
376  // DB
377  task_stats = &data->task_stats_[1];
378  stats->set_db_wait(task_stats->wait_count_);
379  stats->set_db_run(task_stats->enqueue_count_);
380  stats->set_db_defer(task_stats->defer_count_);
381 
382  // Stats Collector
383  task_stats = &data->task_stats_[4];
384  stats->set_stats_wait(task_stats->wait_count_);
385  stats->set_stats_run(task_stats->enqueue_count_);
386  stats->set_stats_defer(task_stats->defer_count_);
387 
388  // Io-Reader
389  task_stats = &data->task_stats_[6];
390  stats->set_io_wait(task_stats->wait_count_);
391  stats->set_io_run(task_stats->enqueue_count_);
392  stats->set_io_defer(task_stats->defer_count_);
393 
394  // Agent::PktFlowResponder
395  task_stats = &data->task_stats_[9];
396  stats->set_flow_resp_wait(task_stats->wait_count_);
397  stats->set_flow_resp_run(task_stats->enqueue_count_);
398  stats->set_flow_resp_defer(task_stats->defer_count_);
399  // Sadnesh::RecvQueue
400  task_stats = &data->task_stats_[5];
401  stats->set_sandesh_rcv_wait(task_stats->wait_count_);
402  stats->set_sandesh_rcv_run(task_stats->enqueue_count_);
403  stats->set_sandesh_rcv_defer(task_stats->defer_count_);
404  // bgp::Config
405  task_stats = &data->task_stats_[11];
406  stats->set_bgp_cfg_wait(task_stats->wait_count_);
407  stats->set_bgp_cfg_run(task_stats->enqueue_count_);
408  stats->set_bgp_cfg_defer(task_stats->defer_count_);
409  // KSync
410  task_stats = &data->task_stats_[8];
411  stats->set_ksync_wait(task_stats->wait_count_);
412  stats->set_ksync_run(task_stats->enqueue_count_);
413  stats->set_ksync_defer(task_stats->defer_count_);
414 }
415 
416 void SandeshTaskStatsRequest::HandleRequest() const {
417  SandeshTaskStatsList *resp = new SandeshTaskStatsList();
418  resp->set_context(context());
419 
420  Agent *agent = Agent::GetInstance();
421  AgentProfile *profile = agent->oper_db()->agent_profile();
422  uint16_t end = profile->seconds_history_index();
423  uint16_t start = 0;
424  if (end > AgentProfile::kSecondsHistoryCount)
426 
427  std::vector<TaskProfileStats> stats_list;
428  for (uint16_t i = start; i < end; i++) {
429  uint16_t index = i % AgentProfile::kSecondsHistoryCount;
430  ProfileData *data = profile->GetProfileData(index);
431  TaskProfileStats stats;
432  GetTaskStats(&stats, index, data);
433  stats_list.push_back(stats);
434  }
435  resp->set_stats(stats_list);
436  resp->Response();
437 }
438 
439 static void GetOneQueueSummary(SandeshFlowQueueSummaryOneInfo *one,
441  one->set_qcount(stats->queue_count_);
442  one->set_enqueues(stats->enqueue_count_);
443  one->set_dequeues(stats->dequeue_count_);
444  one->set_max_qlen(stats->max_queue_count_);
445  one->set_starts(stats->start_count_);
446  one->set_busy_msec(stats->busy_time_);
447 }
448 
449 static void GetQueueSummaryInfo(SandeshFlowQueueSummaryInfo *info, int index,
450  ProfileData *data) {
451  ProfileData::FlowStats *flow_stats = &data->flow_;
452 
453  info->set_index(index);
454  info->set_time_str(data->time_);
455  // flow_event_queue
456  uint64_t qcount = 0;
457  uint64_t enqueues = 0;
458  uint64_t dequeues = 0;
459  uint64_t max_qlen = 0;
460  uint64_t busy_time = 0;
461  uint64_t starts = 0;
462  std::vector<ProfileData::WorkQueueStats>::const_iterator it =
463  flow_stats->flow_event_queue_.begin();
464  while (it != flow_stats->flow_event_queue_.end()) {
465  qcount += it->queue_count_;
466  enqueues += it->enqueue_count_;
467  dequeues += it->dequeue_count_;
468  busy_time += it->busy_time_;
469  starts += it->start_count_;
470  if (it->max_queue_count_ > max_qlen) {
471  max_qlen = it->max_queue_count_;
472  }
473  it++;
474  }
475  SandeshFlowQueueSummaryOneInfo one;
476  one.set_qcount(qcount);
477  one.set_enqueues(enqueues);
478  one.set_dequeues(dequeues);
479  one.set_max_qlen(max_qlen);
480  one.set_starts(starts);
481  one.set_busy_msec(busy_time);
482  info->set_flow_event_queue(one);
483 
484  // flow_tokenless_queue
485  qcount = 0;
486  enqueues = 0;
487  dequeues = 0;
488  max_qlen = 0;
489  busy_time = 0;
490  starts = 0;
491  it = flow_stats->flow_tokenless_queue_.begin();
492  while (it != flow_stats->flow_tokenless_queue_.end()) {
493  qcount += it->queue_count_;
494  enqueues += it->enqueue_count_;
495  dequeues += it->dequeue_count_;
496  busy_time += it->busy_time_;
497  starts += it->start_count_;
498  if (it->max_queue_count_ > max_qlen) {
499  max_qlen = it->max_queue_count_;
500  }
501  it++;
502  }
503  one.set_qcount(qcount);
504  one.set_enqueues(enqueues);
505  one.set_dequeues(dequeues);
506  one.set_max_qlen(max_qlen);
507  one.set_starts(starts);
508  one.set_busy_msec(busy_time);
509  info->set_flow_tokenless_queue(one);
510 
511  // flow_delete_queue
512  qcount = 0;
513  enqueues = 0;
514  dequeues = 0;
515  max_qlen = 0;
516  busy_time = 0;
517  starts = 0;
518  it = flow_stats->flow_delete_queue_.begin();
519  while (it != flow_stats->flow_delete_queue_.end()) {
520  qcount += it->queue_count_;
521  enqueues += it->enqueue_count_;
522  dequeues += it->dequeue_count_;
523  busy_time += it->busy_time_;
524  starts += it->start_count_;
525  if (it->max_queue_count_ > max_qlen) {
526  max_qlen = it->max_queue_count_;
527  }
528  it++;
529  }
530  one.set_qcount(qcount);
531  one.set_enqueues(enqueues);
532  one.set_dequeues(dequeues);
533  one.set_max_qlen(max_qlen);
534  one.set_starts(starts);
535  one.set_busy_msec(busy_time);
536  info->set_flow_delete_queue(one);
537 
538  // flow_ksync_queue
539  qcount = 0;
540  enqueues = 0;
541  dequeues = 0;
542  max_qlen = 0;
543  busy_time = 0;
544  starts = 0;
545  it = flow_stats->flow_ksync_queue_.begin();
546  while (it != flow_stats->flow_ksync_queue_.end()) {
547  qcount += it->queue_count_;
548  enqueues += it->enqueue_count_;
549  dequeues += it->dequeue_count_;
550  busy_time += it->busy_time_;
551  starts += it->start_count_;
552  if (it->max_queue_count_ > max_qlen) {
553  max_qlen = it->max_queue_count_;
554  }
555  it++;
556  }
557  one.set_qcount(qcount);
558  one.set_enqueues(enqueues);
559  one.set_dequeues(dequeues);
560  one.set_max_qlen(max_qlen);
561  one.set_starts(starts);
562  one.set_busy_msec(busy_time);
563  info->set_flow_ksync_queue(one);
564 
565  // flow_mgmt_queue
566  GetOneQueueSummary(&one, &flow_stats->flow_mgmt_queue_);
567  info->set_flow_mgmt_queue(one);
568 
569  // flow_update_queue
570  GetOneQueueSummary(&one, &flow_stats->flow_update_queue_);
571  info->set_flow_update_queue(one);
572 
573  // flow_stats_queue
574  qcount = 0;
575  enqueues = 0;
576  dequeues = 0;
577  max_qlen = 0;
578  busy_time = 0;
579  starts = 0;
580  it = flow_stats->flow_stats_queue_.begin();
581  while (it != flow_stats->flow_stats_queue_.end()) {
582  qcount += it->queue_count_;
583  enqueues += it->enqueue_count_;
584  dequeues += it->dequeue_count_;
585  busy_time += it->busy_time_;
586  starts += it->start_count_;
587  if (it->max_queue_count_ > max_qlen) {
588  max_qlen = it->max_queue_count_;
589  }
590  it++;
591  }
592  one.set_qcount(qcount);
593  one.set_enqueues(enqueues);
594  one.set_dequeues(dequeues);
595  one.set_max_qlen(max_qlen);
596  one.set_starts(starts);
597  one.set_busy_msec(busy_time);
598  info->set_flow_stats_queue(one);
599 
600  // pkt_handler queue
601  GetOneQueueSummary(&one, &flow_stats->pkt_handler_queue_);
602  info->set_pkt_handler_queue(one);
603 
604  // ksync_tx_queue
606  info->set_ksync_tx_queue(one);
607 
608  // ksync_rx_queue
610  info->set_ksync_rx_queue(one);
611 
612  SandeshFlowTokenInfo token_info;
613  ProfileData::FlowTokenStats *token_stats = &flow_stats->token_stats_;
614  token_info.set_add_tokens(token_stats->add_tokens_);
615  token_info.set_add_token_full(token_stats->add_failures_);
616  token_info.set_add_token_restarts(token_stats->add_restarts_);
617  token_info.set_ksync_tokens(token_stats->ksync_tokens_);
618  token_info.set_ksync_token_full(token_stats->ksync_failures_);
619  token_info.set_ksync_token_restarts(token_stats->ksync_restarts_);
620  token_info.set_update_tokens(token_stats->update_tokens_);
621  token_info.set_update_token_full(token_stats->update_failures_);
622  token_info.set_update_token_restarts(token_stats->update_restarts_);
623  token_info.set_delete_tokens(token_stats->del_tokens_);
624  token_info.set_delete_token_full(token_stats->del_failures_);
625  token_info.set_delete_token_restarts(token_stats->del_restarts_);
626  info->set_token_stats(token_info);
627 }
628 
629 void SandeshFlowQueueSummaryRequest::HandleRequest() const {
630  SandeshFlowQueueSummaryResp *resp = new SandeshFlowQueueSummaryResp();
631 
632  Agent *agent = Agent::GetInstance();
633  AgentProfile *profile = agent->oper_db()->agent_profile();
634  uint16_t end = profile->seconds_history_index();
635  uint16_t start = 0;
636  if (end > AgentProfile::kSecondsHistoryCount)
638 
639  std::vector<SandeshFlowQueueSummaryInfo> info_list;
640  for (uint16_t i = start; i < end; i++) {
641  uint16_t index = i % AgentProfile::kSecondsHistoryCount;
642  ProfileData *data = profile->GetProfileData(index);
643  SandeshFlowQueueSummaryInfo info;
644  GetQueueSummaryInfo(&info, index, data);
645  info_list.push_back(info);
646  }
647 
648  resp->set_summary(info_list);
649  resp->set_context(context());
650  resp->Response();
651 }
652 
653 void SandeshSetProfileParams::HandleRequest() const {
654  SandeshProfileParams *resp = new SandeshProfileParams();
655  Agent *agent = Agent::GetInstance();
656  TaskScheduler *scheduler = agent->task_scheduler();
657 
658  scheduler->EnableLatencyThresholds(get_task_exec_threshold() * 1000,
659  get_task_schedule_threshold() * 1000);
660  agent->SetMeasureQueueDelay(get_measure_queue_run_time());
661 
662  resp->set_task_exec_threshold(scheduler->execute_delay()/1000);
663  resp->set_task_schedule_threshold(scheduler->schedule_delay()/1000);
664  resp->set_measure_queue_run_time(agent->MeasureQueueDelay());
665  resp->set_context(context());
666  resp->Response();
667 }
bool MeasureQueueDelay()
Definition: agent.cc:1136
XmppStats rx_stats_
Agent * agent_
WorkQueueStats flow_update_queue_
Definition: agent_profile.h:66
std::vector< WorkQueueStats > flow_delete_queue_
Definition: agent_profile.h:69
int wait_count_
Number of entries in waitq.
Definition: task.h:29
const_iterator const_end()
Definition: db.h:74
static Agent * GetInstance()
Definition: agent.h:436
The TaskScheduler keeps track of what tasks are currently schedulable. When a task is enqueued it is ...
Definition: task.h:178
uint64_t enqueue_count() const
Definition: db_table.h:116
time_t start_time_
uint16_t seconds_history_index() const
ProfileCb ksync_stats_cb_
DB * db() const
Definition: agent.h:1118
void Get(const DBTable *table)
std::map< std::string, DBTableStats > profile_stats_table_
uint64_t input_count() const
Definition: db_table.h:120
WorkQueueStats ksync_rx_queue_count_
AgentProfile(Agent *agent, bool enable)
uint32_t execute_delay() const
Definition: task.h:302
WorkQueueStats pkt_handler_queue_
Definition: agent_profile.h:64
virtual size_t Size() const
Definition: db_table.h:100
DBTableStats evpn_routes_
#define kVmDbTablePrefix
Definition: agent.h:347
#define kVrfDbTablePrefix
Definition: agent.h:348
TaskStats * GetTaskGroupStats(int task_id)
Definition: task.cc:899
ProfileData * GetProfileData(uint16_t index)
static const uint32_t kProfileTimeout
std::vector< WorkQueueStats > flow_ksync_queue_
Definition: agent_profile.h:70
XmppStats tx_stats_
ProfileData seconds_history_data_[kSecondsHistoryCount]
static void GetFlowStats(SandeshFlowStats *stats, int index, ProfileData *data)
#define kEvpnRouteDbTableSuffix
Definition: agent.h:355
std::string time_
void SetMeasureQueueDelay(bool val)
Definition: agent.cc:1140
OperDB * oper_db() const
Definition: agent.cc:1013
int GetTaskId(const std::string &name)
Definition: task.cc:856
void EnableLatencyThresholds(uint32_t execute, uint32_t schedule)
Enable logging of tasks exceeding configured latency.
Definition: task.cc:595
uint64_t notify_count() const
Definition: db_table.h:124
uint16_t seconds_history_index_
#define kMcastRouteDbTableSuffix
Definition: agent.h:354
virtual size_t Size() const
Definition: db_table.cc:507
TaskScheduler * task_scheduler() const
Definition: agent.h:1120
#define kV4UnicastRouteDbTableSuffix
Definition: agent.h:351
Definition: task.h:26
Definition: agent.h:358
static TaskScheduler * GetInstance()
Definition: task.cc:547
const_iterator const_begin()
Definition: db.h:73
static const uint16_t kSecondsHistoryCount
WorkQueueStats flow_mgmt_queue_
Definition: agent_profile.h:65
EventManager * event_manager() const
Definition: agent.h:1103
DBTableStats inet6_routes_
static void DBStatsToSandesh(SandeshDBTableStats *stats, const string &table, const ProfileData::DBTableStats &db_stats)
std::vector< WorkQueueStats > flow_event_queue_
Definition: agent_profile.h:67
static void GetDBTableStats(SandeshDBTableStatsInfo *stats, int index, ProfileData *data)
static void GetTaskStats(TaskProfileStats *stats, int index, ProfileData *data)
void Get(Agent *agent)
FlowStats flow_
int defer_count_
Number of entries in deferq.
Definition: task.h:35
#define kL2RouteDbTableSuffix
Definition: agent.h:353
static Timer * CreateTimer(boost::asio::io_context &service, const std::string &name, int task_id=Timer::GetTimerTaskId(), int task_instance=Timer::GetTimerInstanceId(), bool delete_on_completion=false)
Definition: timer.cc:201
FlowTokenStats token_stats_
Definition: agent_profile.h:63
string GetProfileString(DBTable *table, const char *name)
ProfileData * GetLastProfileData()
bool Cancel()
Definition: timer.cc:150
#define kV6UnicastRouteDbTableSuffix
Definition: agent.h:352
#define kMplsDbTablePrefix
Definition: agent.h:349
uint64_t enqueue_count_
Number of tasks enqueued.
Definition: task.h:38
DBTableStats bridge_routes_
void Accumulate(const DBTableBase *table)
bool Start(int time, Handler handler, ErrorHandler error_handler=NULL)
Definition: timer.cc:108
#define kAclDbTablePrefix
Definition: agent.h:350
uint64_t walker_count() const
Definition: db_table.h:129
WorkQueueStats ksync_tx_queue_count_
DBTableStats multicast_routes_
TaskStats task_stats_[24]
std::vector< WorkQueueStats > flow_stats_queue_
Definition: agent_profile.h:71
DBTableStats inet4_routes_
#define kInterfaceDbTablePrefix
Definition: agent.h:345
std::vector< WorkQueueStats > flow_tokenless_queue_
Definition: agent_profile.h:68
Timer * timer_
AgentProfile * agent_profile() const
Definition: operdb_init.h:79
ProfileCb pkt_flow_stats_cb_
uint32_t schedule_delay() const
Definition: task.h:301
static void GetOneQueueSummary(SandeshFlowQueueSummaryOneInfo *one, ProfileData::WorkQueueStats *stats)
ProfileCb flow_stats_cb_
PktStats pkt_
struct task_ task
static void GetQueueSummaryInfo(SandeshFlowQueueSummaryInfo *info, int index, ProfileData *data)
static bool DeleteTimer(Timer *Timer)
Definition: timer.cc:222
#define kVnDbTablePrefix
Definition: agent.h:346