<font size=2 face="sans-serif">Hello,</font>
<br><font size=2 face="sans-serif"> When reading profiling
code, I found function '_CPU_Counter_difference' may overflow, and it will
result in 'per_cpu->max_interrupt_time' become a wrong larger
value.</font>
<br><font size=2 face="sans-serif"> If a cpu counter is 32bit,
and it's resolution is 800ns, the counter will overflow every 3436 seconds(_CPU_Counter_read).</font>
<br><font size=2 face="sans-serif"> Then, _Profiling_Outer_most_interrupt_entry_and_exit->_CPU_Counter_difference
will have a incorrect result. </font>
<br><font size=2 face="sans-serif"> </font>
<br><font size=2 face="sans-serif"> So,</font>
<br><font size=2 face="sans-serif"> 1. Is it a bug?</font>
<br><font size=2 face="sans-serif"> static inline CPU_Counter_ticks
_CPU_Counter_difference(</font>
<br><font size=2 face="sans-serif"> CPU_Counter_ticks
second,
</font>
<br><font size=2 face="sans-serif"> CPU_Counter_ticks
first)
</font>
<br><font size=2 face="sans-serif"> {
</font>
<br><font size=2 face="sans-serif"> return
second - first;
</font>
<br><font size=2 face="sans-serif"> } </font>
<br><font size=2 face="sans-serif"> 2. If it is, I want to
fix it as blow:</font>
<br><font size=2 face="sans-serif"> #define MAX_COUNT_TICKS
(0xFFFFFFFF)</font>
<br><font size=2 face="sans-serif"> static inline CPU_Counter_ticks
_CPU_Counter_difference(</font>
<br><font size=2 face="sans-serif"> CPU_Counter_ticks
second,
</font>
<br><font size=2 face="sans-serif"> CPU_Counter_ticks
first)
</font>
<br><font size=2 face="sans-serif"> {
</font>
<br><font size=2 face="sans-serif"> if (second
> first) {</font>
<br><font size=2 face="sans-serif">
return second - first; </font>
<br><font size=2 face="sans-serif"> } else {</font>
<br><font size=2 face="sans-serif"> return
MAX_COUNT_TICKS - first + second;</font>
<br><font size=2 face="sans-serif"> }</font>
<br><font size=2 face="sans-serif"> } </font>
<br>
<br><font size=2 face="sans-serif">Regards!</font>