Skip to content

[BUG] testing/sched/timerjitter: unexpected results under normal usage #3634

Description

@hitHuang

Description / Steps to reproduce the issue

Found while testing apps/testing/sched/timerjitter on QEMU RISC-V (rv-virt), NuttX-13.0.0-RC2. All three reproduce under normal, non-adversarial usage. A separate off-by-one in the sample loop was already
fixed in pull#3629

  1. avg: nan with default args
  nsh> timerjitter
  timer jitter in 0 run:
  (latency/us) min: 4294967295, avg: nan, max 0

Running with no arguments at all completes 0 iterations and prints avg: nan. Should the default guarantee at least 1 iteration, or otherwise avoid printing nan?

  1. Very large missed-frame counts, one run did not finish
  nsh> timerjitter 100 5
  time frame missed 1
  ...
  time frame missed 17363
  timer jitter in 5 run:
  (latency/us) min: 3129, avg: 347295, max 1269743

Another run with the same arguments printed missed-frame lines continuously and never completed; it had to be terminated externally:

  nsh> timerjitter 100 5
  time frame missed 1
  ...
  time frame missQEMU: Terminated
  1. Negative jitter shown as a huge unsigned value
  nsh> timerjitter 10000 10
  time frame missed 1
  timer jitter in 10 run:
  (latency/us) min: 4294966445, avg: 1010, max 12854

4294966445 = 2^32 - 851. avg in the same run is a small, plausible number, while min is not — suggesting min/max end up holding a negative value that gets displayed as a large unsigned one.

On which OS does this issue occur?

[OS: Linux]

What is the version of your OS?

Ubuntu 20.04

NuttX Version

master

Issue Architecture

[Arch: all]

Issue Area

[Area: Testing]

Host information

Environment

  • Board/config: boards/risc-v/qemu-rv/rv-virt/configs/knsh_romfs, running on QEMU
  • CONFIG_USEC_PER_TICK changed from the board's default (1000) back to the Kconfig default 10000

Verification

  • I have verified before submitting the report.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions