Frame Time Percentiles and Budget Misses From Profiler Captures
Last updated: November 29, 2026
Quick Overview
Given a list of per-frame times in milliseconds captured from a game build, return the p50, p95 and p99 frame times using the nearest-rank method, the worst frame, and how many frames exceeded a target budget such as 16.67 ms.
Unity
November 29, 20260
0
0 solved
Given a list of per-frame times in milliseconds captured from a game build, return the p50, p95 and p99 frame times using the nearest-rank method, the worst frame, and how many frames exceeded a target budget such as 16.67 ms.
A warm-up in the style of Unity engine and tools phone screens, where performance data from the Profiler is everyday material. The interviewer checks that you can turn a vague 'is it smooth' question into precise statistics and that you know why averages hide hitches.
What the Interviewer Expects
- Explain why average FPS is misleading compared with tail percentiles
- Pick and state a percentile definition (nearest rank) and apply it consistently
- Count budget misses in one pass without mutating the input
- Handle empty input and single-frame captures
- State O(n log n) time from sorting and when a selection algorithm would help
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you compute p99 over a rolling window of the last 300 frames in a live overlay?
- How would you detect hitches defined as frames more than twice the median?
- If captures have millions of frames, how would you avoid a full sort?
- How does 30 Hz versus 60 Hz target change the budget and the interpretation?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: a list of frame durations in ms (floats or ints), a budget (default 16.67 ms for 60 FPS) and percentiles to report. Output: a dict with the percentile values, the worst frame and the count of f...
High-Level Design
Sort a copy once, then each percentile is an index lookup. Count budget misses with a single pass over the original list. Averages are deliberately not the headline: a capture that is 15 ms for 99 fra...