View the number of visible CPU cores


To view the number of visible CPU cores, use the gcloud CLI or the Compute Engine API.

gcloud

  1. Get information about the VM by using the following gcloud beta compute instances describe command.

    gcloud compute instances describe VM_NAME \
        --zone=ZONE
    

    Replace the following:

    • VM_NAME: the name of the VM

    • ZONE: the zone that contains the VM

  2. The value of visible-core-count in the output is the number of visible CPU cores.

API

  1. Get information about the VM by using the following instances.get method.

    GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/VM_NAME
    

    Replace the following:

    • PROJECT_ID: the ID of the project

    • ZONE: the zone that contains the VM

    • VM_NAME: the name of the VM

  2. The value of visibleCoreCount in the output is the number of visible CPU cores.