> > +fn read_trace_records(
> > + events: &Vec<Event>,
> > + fobj: &File,
> > + analyzer: &mut Formatter,
> > + read_header: bool,
> > +) -> Result<Vec<String>>
> > +{
> > + /* backtrace::Backtrace needs this env variable. */
> > + env::set_var("RUST_BACKTRACE", "1");
> > + let bt = Backtrace::new();
> > + let raw_frame = bt.frames().first().unwrap();
> > + let frameinfo = raw_frame.symbols().first().unwrap();
> > +
> > + let dropped_event = Event::build(
> > + "Dropped_Event(uint64_t num_events_dropped)",
> > + frameinfo.lineno().unwrap() + 1,
> > + frameinfo.filename().unwrap().to_str().unwrap(),
> > + )
> > + .unwrap();
>
> Is the backtrace necessary? This trick was used in Python where it's
> part of the standard library, but I don't think there is any need for
> Dropped_Event to refer to this line in the source code.
>
> Maybe Rust has a way to do this at compile-time or you can hardcode
> values instead.
Thanks your reminder, I'll think about the hardcode approach as the
easiest solution...removing the backtrace can help a lot here.
Regards,
Zhao