Repository navigation
feat: support perfcounter and more information trace log - #945
Conversation
|
I think this pull request adds a new feature, it is more suitable to use |
sub_tracer is |
| #include <dsn/utility/synchronize.h> | ||
| #include <dsn/utility/flags.h> | ||
| #include <dsn/dist/fmt_logging.h> | ||
| #include <dsn/perf_counter/perf_counters.h> |
|
|
||
| std::string name() { return _name; } | ||
|
|
||
| std::string description() { return _description; } |
There was a problem hiding this comment.
const std::string& description() const
|
|
||
| dsn::task_code _task_code; | ||
|
|
||
| utils::rw_lock_nr _point_lock; |
There was a problem hiding this comment.
utils::rw_lock_nr _point_lock; // {
std::map<int64_t, std::string> _points;
// }
| std::shared_ptr<latency_tracer> _sub_tracer; | ||
|
|
||
| std::string _parent_point_name; | ||
| utils::rw_lock_nr _sub_lock; |
| uint64_t ts = dsn_now_ns(); | ||
| utils::auto_write_lock write(_lock); | ||
| _points[ts] = stage_name; | ||
| utils::auto_write_lock write(_point_lock); |
There was a problem hiding this comment.
{
utils::auto_write_lock write(_point_lock);
_points.emplace(ts, stage_name);
}
There was a problem hiding this comment.
_last_time need also lock
|
|
||
| traces.append(fmt::format("\t***************[TRACE:{}]***************\n", _name)); | ||
| uint64_t previous_time = _start_time; | ||
| utils::auto_read_lock point_lock(_point_lock); |
There was a problem hiding this comment.
Would these two locks produce dead lock?
There was a problem hiding this comment.
Yeah, I will fix
| if (time_used < _threshold) { | ||
| void latency_tracer::dump_trace_points(/*out*/ std::string &traces) | ||
| { | ||
| if (!FLAGS_enable_latency_tracer || !_enable_trace || _threshold < 0 || _points.empty()) { |
There was a problem hiding this comment.
Does this code have thread safet issues?
_points.empty()
There was a problem hiding this comment.
Yeah, seem to be not, has updated
apache/incubator-pegasus#883
The pr add two main feature:
New-Config
Log Format Example