[null,null,["最后更新时间 (UTC):2025-07-29。"],[],[],null,["# Profiling limitations\n\nThere are multiple situations where the profile collection might not go as\nexpected:\n\n- The profile collection fails due to an internal error. If this happens, the [`ProfilingResult`](/reference/android/os/ProfilingResult) API tells you about the errors.\n- The profile collection fails due to rate limiting. For more information, see [How rate limiting works](#how-rate-limiting-works)\n- The profile collection succeeds, but the app isn't immediately notified. This can happen if the app crashes during long profile collections. If the app closes, the system automatically stops and saves the profile. The app is informed about the collected profile when it restarts and registers a general listener with `ProfilingManager`.\n\nHow rate limiting works\n-----------------------\n\n`ProfilingManager` includes a rate limiter for both individual apps and the\nentire system. The rate limiter prevents apps from using too many system\nresources by recording too many profiles, because a full profiling session uses\na lot of resources.\n| **Key Point:** You can tell if your app has been rate-limited by checking the `ProfilingResult`. You will see either the `ERROR_FAILED_RATE_LIMIT_PROCESS` or `ERROR_FAILED_RATE_LIMIT_SYSTEM` error.\n\nBoth the app and system rate limiters assign a cost to each type of profile\ncollected, because some profiles are more resource-intensive than others. The\napp limiter controls how much an individual app can record based on its total\ncost. The system limiter, however, controls the total cost of all profiles\nrecorded by all apps.\n\nThe rate limiter sets a total cost that each app can use (this cost is the same\nfor all apps). Each profile uses a part of this total cost, depending on its\ntype.\n\nThe rate limiter uses three time periods:\n\n- **Per Hour:** There's a maximum cost allowed per hour.\n- **Per Day:** There's a maximum cost allowed per day.\n- **Per Week:** There's a maximum cost allowed per week.\n\nThe rate limiter sets a total cost that can be used within each of these\nperiods. For example, an app might be allowed to record X profiles per hour, Y\nper day, and Z per week. If your app reaches its limit in any of these periods,\nfuture profile requests will result in an `ERROR_FAILED_RATE_LIMIT_PROCESS`\nerror.\n\nThese time periods work similarly for system-level rate limiting. However, the\nsystem rate limiter is a global limit shared by all apps. This limit is set\nseparately from the individual app quotas, but every profile contributes to it,\nusing the same hourly, daily, and weekly periods. If this global limit is\nreached, you will receive the `ERROR_FAILED_RATE_LIMIT_SYSTEM` error.\n| **Tip:** For local profiling, you can [disable the rate limiter](/topic/performance/tracing/profiling-manager/debug-mode#disable-rate-limiter)."]]