Skip to content

Commit

Permalink
Merge "Introspect enhancements to configure latency measurements"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Jun 23, 2016
2 parents 3e3bf71 + d31d238 commit 92fb820
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/base/queue_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ class WorkQueue {
uint32_t task_starts() const { return task_starts_; }
uint32_t max_queue_len() const { return max_queue_len_; }
bool measure_busy_time() const { return measure_busy_time_; }
void set_measure_busy_time(bool val) { measure_busy_time_ = val; }
void set_measure_busy_time(bool val) const { measure_busy_time_ = val; }
uint64_t busy_time() const { return busy_time_; }
void add_busy_time(uint64_t t) { busy_time_ += t; }
void ClearStats() const {
Expand Down Expand Up @@ -669,7 +669,7 @@ class WorkQueue {
mutable uint32_t task_starts_;
mutable uint32_t max_queue_len_;
mutable uint64_t busy_time_;
bool measure_busy_time_;
mutable bool measure_busy_time_;

friend class QueueTaskTest;
friend class QueueTaskShutdownTest;
Expand Down
3 changes: 3 additions & 0 deletions src/base/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ class TaskScheduler {

// Enable logging of tasks exceeding configured latency
void EnableLatencyThresholds(uint32_t execute, uint32_t schedule);
uint32_t schedule_delay() const { return schedule_delay_; }
uint32_t execute_delay() const { return execute_delay_; }

bool measure_delay() const { return measure_delay_; }
void SetLatencyThreshold(const std::string &name, uint32_t execute,
uint32_t schedule);
Expand Down
4 changes: 4 additions & 0 deletions src/vnsw/agent/cmn/agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -866,3 +866,7 @@ void Agent::TaskTrace(const char *file_name, uint32_t line_no,
bool Agent::MeasureQueueDelay() {
return params_->measure_queue_delay();
}

void Agent::SetMeasureQueueDelay(bool val) {
return params_->set_measure_queue_delay(val);
}
1 change: 1 addition & 0 deletions src/vnsw/agent/cmn/agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,7 @@ class Agent {
flow_stats_req_handler_ = req;
}

void SetMeasureQueueDelay(bool val);
bool MeasureQueueDelay();
void TaskTrace(const char *file_name, uint32_t line_no, const Task *task,
const char *description, uint32_t delay);
Expand Down
1 change: 1 addition & 0 deletions src/vnsw/agent/init/agent_param.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ class AgentParam {
uint32_t pkt0_tx_buffer_count() const { return pkt0_tx_buffer_count_; }
void set_pkt0_tx_buffer_count(uint32_t val) { pkt0_tx_buffer_count_ = val; }
bool measure_queue_delay() const { return measure_queue_delay_; }
void set_measure_queue_delay(bool val) { measure_queue_delay_ = val; }
protected:
void set_hypervisor_mode(HypervisorMode m) { hypervisor_mode_ = m; }
virtual void InitFromSystem();
Expand Down
16 changes: 16 additions & 0 deletions src/vnsw/agent/oper/agent_profile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -651,3 +651,19 @@ void SandeshFlowQueueSummaryRequest::HandleRequest() const {
resp->set_context(context());
resp->Response();
}

void SandeshSetProfileParams::HandleRequest() const {
SandeshProfileParams *resp = new SandeshProfileParams();
Agent *agent = Agent::GetInstance();
TaskScheduler *scheduler = agent->task_scheduler();

scheduler->EnableLatencyThresholds(get_task_exec_threshold() * 1000,
get_task_schedule_threshold() * 1000);
agent->SetMeasureQueueDelay(get_measure_queue_run_time());

resp->set_task_exec_threshold(scheduler->execute_delay()/1000);
resp->set_task_schedule_threshold(scheduler->schedule_delay()/1000);
resp->set_measure_queue_run_time(agent->MeasureQueueDelay());
resp->set_context(context());
resp->Response();
}
19 changes: 19 additions & 0 deletions src/vnsw/agent/oper/agent_profile.sandesh
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,22 @@ response sandesh SandeshTaskStatsList {
request sandesh SandeshTaskStatsRequest {
1: u16 count; // send data for last 'count' entries
}

/**
* Response message for SandeshSetTaskProfileParams
* Shows modified parameters
*/
response sandesh SandeshProfileParams {
1: u16 task_exec_threshold;
2: u16 task_schedule_threshold;
3: bool measure_queue_run_time;
}

/**
* Request to tune to task-profiling parameters
*/
request sandesh SandeshSetProfileParams {
1: u16 task_exec_threshold;
2: u16 task_schedule_threshold;
3: bool measure_queue_run_time;
}
6 changes: 5 additions & 1 deletion src/vnsw/agent/pkt/flow_proto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -745,8 +745,10 @@ static void SetFlowEventQueueStats(Agent *agent,
stats->max_queue_count_ = queue->max_queue_len();
stats->start_count_ = queue->task_starts();
stats->busy_time_ = queue->busy_time();
if (agent->MeasureQueueDelay())
queue->set_measure_busy_time(agent->MeasureQueueDelay());
if (agent->MeasureQueueDelay()) {
queue->ClearStats();
}
}

static void SetFlowMgmtQueueStats(Agent *agent,
Expand All @@ -759,6 +761,7 @@ static void SetFlowMgmtQueueStats(Agent *agent,
stats->max_queue_count_ = queue->max_queue_len();
stats->start_count_ = queue->task_starts();
stats->busy_time_ = queue->busy_time();
queue->set_measure_busy_time(agent->MeasureQueueDelay());
if (agent->MeasureQueueDelay())
queue->ClearStats();
}
Expand All @@ -773,6 +776,7 @@ static void SetPktHandlerQueueStats(Agent *agent,
stats->max_queue_count_ = queue->max_queue_len();
stats->start_count_ = queue->task_starts();
stats->busy_time_ = queue->busy_time();
queue->set_measure_busy_time(agent->MeasureQueueDelay());
if (agent->MeasureQueueDelay())
queue->ClearStats();
}
Expand Down
1 change: 1 addition & 0 deletions src/vnsw/agent/vrouter/flow_stats/flow_stats_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ static void SetQueueStats(Agent *agent, FlowStatsCollector *fsc,
stats->max_queue_count_ = fsc->queue()->max_queue_len();
stats->start_count_ = fsc->queue()->task_starts();
stats->busy_time_ = fsc->queue()->busy_time();
fsc->queue()->set_measure_busy_time(agent->MeasureQueueDelay());
if (agent->MeasureQueueDelay())
fsc->queue()->ClearStats();
}
Expand Down
8 changes: 6 additions & 2 deletions src/vnsw/agent/vrouter/ksync/ksync_init.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,10 @@ void KSync::SetProfileData(ProfileData *data) {
stats->max_queue_count_ = tx_queue->max_queue_len();
stats->start_count_ = tx_queue->read_events();
stats->busy_time_ = tx_queue->busy_time();
if (agent()->MeasureQueueDelay())
tx_queue->set_measure_busy_time(agent()->MeasureQueueDelay());
if (agent()->MeasureQueueDelay()) {
tx_queue->ClearStats();
}

const KSyncSock::KSyncReceiveQueue *rx_queue =
sock->get_receive_work_queue(0);
Expand All @@ -166,8 +168,10 @@ void KSync::SetProfileData(ProfileData *data) {
stats->max_queue_count_ = rx_queue->max_queue_len();
stats->start_count_ = rx_queue->task_starts();
stats->busy_time_ = rx_queue->busy_time();
if (agent()->MeasureQueueDelay())
rx_queue->set_measure_busy_time(agent()->MeasureQueueDelay());
if (agent()->MeasureQueueDelay()) {
rx_queue->ClearStats();
}
}

void KSync::VRouterInterfaceSnapshot() {
Expand Down

0 comments on commit 92fb820

Please sign in to comment.