the overall amount spent in API cycles, as returned by the system.
Returns 0 if the feature is not supported.
getCpuTimeInMegaCycles()
publicabstractlonggetCpuTimeInMegaCycles()
Measures the duration that the current request has spent so far processing
the request within the App Engine sandbox. Note that time spent in API
calls will not be added to this value.
The unit the duration is measured is Megacycles. If all instructions
were to be executed sequentially on a standard 1.2 GHz 64-bit x86 CPU,
1200 megacycles would equate to one second physical time elapsed.
Tests if the QuotaService can provide a certain kind of data at this
point in time. Depending on the underlying app server implementation and
what state it is in, a QuotaService might not always have access to all
categories of data. For example, the dev-appserver might not be able to
measure the megacycles of api calls. Trying to access that data would lead
to an IllegalStateException, which would then need to be handled. To make
it easier to prevent this, it is possible to ask the service if a
particular kind of data is supported.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eQuotaService\u003c/code\u003e interface measures API and CPU usage during requests.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003econvertCpuSecondsToMegacycles\u003c/code\u003e and \u003ccode\u003econvertMegacyclesToCpuSeconds\u003c/code\u003e methods facilitate the conversion between CPU seconds and megacycles, using a theoretical 1.2 GHz CPU as a basis.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetCpuTimeInMegaCycles\u003c/code\u003e measures the duration of a request within the App Engine sandbox in megacycles, excluding API call time.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003esupports\u003c/code\u003e method will allow you to test if the service can provide certain data at that point in time.\u003c/p\u003e\n"]]],[],null,["# Interface QuotaService (2.0.0)\n\n public interface QuotaService\n\nThe `QuotaService` provides measurement of API and CPU usage\nduring requests.\n\nMethods\n-------\n\n### convertCpuSecondsToMegacycles(double cpuSeconds)\n\n public abstract long convertCpuSecondsToMegacycles(double cpuSeconds)\n\nExpresses a value in megaCycles as its approximate equivalent of CPU\nseconds on a theoretical 1.2 GHz CPU.\n\n### convertMegacyclesToCpuSeconds(long megaCycles)\n\n public abstract double convertMegacyclesToCpuSeconds(long megaCycles)\n\nExpresses a value in megaCycles as its approximate equivalent of CPU\nseconds on a theoretical 1.2 GHz CPU.\n\n### getApiTimeInMegaCycles() (deprecated)\n\n public abstract long getApiTimeInMegaCycles()\n\n**Deprecated.** *This value is no longer meaningful.*\n\n### getCpuTimeInMegaCycles()\n\n public abstract long getCpuTimeInMegaCycles()\n\nMeasures the duration that the current request has spent so far processing\nthe request within the App Engine sandbox. Note that time spent in API\ncalls will not be added to this value.\n\n\nThe unit the duration is measured is Megacycles. If all instructions\nwere to be executed sequentially on a standard 1.2 GHz 64-bit x86 CPU,\n1200 megacycles would equate to one second physical time elapsed.\n\n### supports(QuotaService.DataType type)\n\n public abstract boolean supports(QuotaService.DataType type)\n\nTests if the QuotaService can provide a certain kind of data at this\npoint in time. Depending on the underlying app server implementation and\nwhat state it is in, a QuotaService might not always have access to all\ncategories of data. For example, the dev-appserver might not be able to\nmeasure the megacycles of api calls. Trying to access that data would lead\nto an IllegalStateException, which would then need to be handled. To make\nit easier to prevent this, it is possible to ask the service if a\nparticular kind of data is supported."]]