Skip to content

Instantly share code, notes, and snippets.

@CapacitorSet
Created July 2, 2023 10:50
Show Gist options
  • Select an option

  • Save CapacitorSet/29b34ba77e8f6662e79f5894d82aec47 to your computer and use it in GitHub Desktop.

Select an option

Save CapacitorSet/29b34ba77e8f6662e79f5894d82aec47 to your computer and use it in GitHub Desktop.

Revisions

  1. CapacitorSet created this gist Jul 2, 2023.
    11 changes: 11 additions & 0 deletions cgroups.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    You can use cgroups to cap the CPU usage of processes. Thus, you can make the shader compilation process use less CPU and produce less heat, in exchange for longer compilation times.

    Requires: Linux, a somewhat recent kernel, possibly a package for cgcreate.

    ```sh
    sudo cgcreate -g cpu:/slow # Create a CPU cgroup
    sudo cgclassify -g cpu:slow $(pidof fossilize_replay) # Move all shader compilation processes to the cgroup
    sudo cgset -r cpu.max='2000000 1000000' slow # Cap the CPU usage (in this case: to 2 CPUs)
    ```

    You may need to rerun the `cgclassify` from time to time.