Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Could not parse ATrace line "CPU:3 [LOST 4262 EVENTS]" #291

Closed
kirillzyusko opened this issue Jun 12, 2024 · 3 comments · Fixed by #295
Closed

Error: Could not parse ATrace line "CPU:3 [LOST 4262 EVENTS]" #291

kirillzyusko opened this issue Jun 12, 2024 · 3 comments · Fixed by #295

Comments

@kirillzyusko
Copy link
Contributor

kirillzyusko commented Jun 12, 2024

I'm getting error Error: Could not parse ATrace line "CPU:3 [LOST 4262 EVENTS]" in

interval: parseLine(lines[lines.length - 1]).timestamp - parseLine(lines[0]).timestamp,

And parent call happens from:

const { frameTimes, interval: atraceInterval } = frameTimeParser.getFrameTimes(atrace, pid);

Currently I fixed it with next construction:

  let output;
  try {
    output = frameTimeParser.getFrameTimes(atrace, pid);
  } catch (e) {
    console.error(e);
  }
  
  if (!output) {
    return;
  }
  
  const { frameTimes, interval: atraceInterval } = output;

In my opinion it's better to ignore one frame rather than crash the profiler.

The exception happens when I just launched emulator and run a lot of tests sequentially, the test execution is several seconds, then I do a short break (maybe 100ms) and repeat a test.

This is a full stack trace, but don't look at number of lines - I applied a patch, so some of line numbers are not correct:

Error: Could not parse ATrace line "CPU:2 [LOST 8693 EVENTS]"
    at parseLine (/Users/kirylziusko/IdeaProjects/project/node_modules/@perf-profiler/android/src/commands/atrace/pollFpsUsage.ts:17:13)
    at FrameTimeParser.getFrameTimes (/Users/kirylziusko/IdeaProjects/project/node_modules/@perf-profiler/android/src/commands/atrace/pollFpsUsage.ts:92:73)
    at /Users/kirylziusko/IdeaProjects/project/node_modules/@perf-profiler/android/src/commands/platforms/UnixProfiler.ts:143:10
    at /Users/kirylziusko/IdeaProjects/project/node_modules/@perf-profiler/android/src/commands/platforms/UnixProfiler.ts:202:9
    at /Users/kirylziusko/IdeaProjects/project/node_modules/@perf-profiler/android/src/commands/shell.ts:110:7
    at Array.forEach (<anonymous>)
    at Socket.<anonymous> (/Users/kirylziusko/IdeaProjects/project/node_modules/@perf-profiler/android/src/commands/shell.ts:109:29)
    at Socket.emit (node:events:519:28)
    at Socket.emit (node:domain:488:12)
    at addChunk (node:internal/streams/readable:559:12)
@Almouro
Copy link
Member

Almouro commented Jun 28, 2024

Hi @kirillzyusko, apologies for the delay! We're usually faster than this

In my opinion it's better to ignore one frame rather than crash the profiler.

Yep, I agree, that makes a lot of sense!
Do you want to submit a PR to add your patch? I can pull them along with your other change in the next releases.

@kirillzyusko
Copy link
Contributor Author

@Almouro Yeah, sure. I'll submit a PR today 🙌

@kirillzyusko
Copy link
Contributor Author

@Almouro opened it here #295

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants