Module screeps::game::cpu

source ·
Expand description

Information about, and functions to manage, your code’s resource utilization

Screeps documentation

Structs

  • Object with info about the memory heap of your virtual machine.

Functions

  • The amount of CPU that has accumulated in your bucket.
  • generate_pixelgenerate-pixel
    Generate a Pixel, consuming PIXEL_CPU_COST CPU from your bucket.
  • Get information about your script’s memory heap usage.
  • Get the amount of CPU time used for execution so far this tick.
  • Stop execution of your script immediately and requests the destruction of your code’s environment, which will start fresh on the following tick.
  • Your assigned CPU for the current shard.
  • Sets new shard limits for your script in an Object, with shard names in JsString form as keys and numbers as values. This is the same format accepted by shard_limits. Total amount of CPU should remain equal to the sum of the values of shard_limits. This method can be used only once per 12 hours (CPU_SET_SHARD_LIMITS_COOLDOWN).
  • Your assigned CPU limits for each shard in an Object, with shard names in JsString form as keys and numbers as values. This is the same format accepted by set_shard_limits.
  • The amount of CPU available for execution this tick, which consists of your per-tick CPU limit plus your accrued bucket, up to a maximum of 500 (CPU_TICK_LIMIT_MAX); f64::INFINITY on sim.
  • Consume a CpuUnlock to unlock your full CPU for 24 hours.
  • Whether your account is unlocked to have full CPU.
  • If your account has been unlocked for a limited time, contains the time it’s unlocked until in milliseconds since epoch.