RE: [PATCH v4 07/12] btrace: Remove struct btrace_thread_info::{begin,end}.

Metzger, Markus T
2017-05-11T10:02:52Z

Hello Tim,

> - /* The last function segment contains the current instruction, which is not
> - really part of the trace. If it contains just this one instruction, we
> - stop when we reach it; otherwise, we let the below loop run to the end. */
> - end = btinfo->end;
> - if (VEC_length (btrace_insn_s, end->insn) > 1)
> - end = NULL;
> -
> level = INT_MAX;
> - for (; bfun != end; bfun = bfun->flow.next)
> - level = std::min (level, bfun->level);
> + length = btinfo->functions.size ();
> + for (const auto &bfun: btinfo->functions)
> + {
> + /* The last function segment contains the current instruction, which is
> + not really part of the trace. If it contains just this one
> + instruction, we ignore the segment. */
> + if (bfun->number == length && VEC_length (btrace_insn_s, bfun->insn) == 1)
> + continue;
> +
> + level = std::min (level, bfun->level);
> + }

This adds an additional bfun->number == length check to the loop that could be
avoided by iterating over indices.

Regards,
Markus.

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928