Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Linux
Windows
Questo documento descrive come visualizzare il numero di core CPU visibili per un'istanza di una macchina virtuale (VM).
Quando visualizzi i dettagli di una VM, puoi verificare se la VM ha il numero predefinito di core CPU visibili o se questo numero è stato personalizzato. La riduzione del numero di core CPU visibili per una VM può contribuire a limitare i costi di licenza senza ridurre i limiti delle prestazioni di Persistent Disk.
Tuttavia, la riduzione del numero di core CPU visibili potrebbe influire sulle prestazioni di rete.
Prima di iniziare
Se non l'hai ancora fatto, configura l'autenticazione.
L'autenticazione è il processo mediante il quale la tua identità viene verificata per l'accesso ai servizi e alle API Google Cloud .
Per eseguire codice o esempi da un ambiente di sviluppo locale, puoi autenticarti su Compute Engine selezionando una delle seguenti opzioni:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and
APIs, you don't need to set up authentication.
gcloud
Install the Google Cloud CLI.
After installation,
initialize the Google Cloud CLI by running the following command:
Viene visualizzata la pagina dei dettagli della VM e viene selezionata la scheda Dettagli.
Nella sezione Configurazione macchina, controlla il valore di Core visibili personalizzati. Se non viene visualizzato alcun valore, la VM ha il numero predefinito di core CPU visibili.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\u003cp\u003eThis document provides instructions on how to check if a virtual machine (VM) has the default number of visible CPU cores or if it has been customized.\u003c/p\u003e\n"],["\u003cp\u003eReducing the number of visible CPU cores can help decrease licensing costs, but it might impact network performance and overall VM performance.\u003c/p\u003e\n"],["\u003cp\u003eYou can view the number of visible CPU cores through the Google Cloud console, by using the \u003ccode\u003egcloud compute instances describe\u003c/code\u003e command, or by making a \u003ccode\u003eGET\u003c/code\u003e request to the \u003ccode\u003einstances.get\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eIf the \u003ccode\u003evisibleCoreCount\u003c/code\u003e field is present in the output, the VM has a customized number of visible CPU cores; otherwise, it has the default number.\u003c/p\u003e\n"],["\u003cp\u003eTo view the details of the VM, the required permission is \u003ccode\u003ecompute.instances.get\u003c/code\u003e, granted by the \u003ccode\u003eCompute Instance Admin (v1)\u003c/code\u003e role.\u003c/p\u003e\n"]]],[],null,["# View the number of visible CPU cores\n\nLinux Windows\n\n*** ** * ** ***\n\nThis document describes how to view the number of visible CPU cores for a\nvirtual machine (VM) instance.\n\nWhen you\n[view the details of a VM](/compute/docs/instances/view-vm-details), you\ncan verify if the VM has the default number of visible CPU cores, or if this\nnumber has been customized. Reducing the number of visible CPU cores for a VM\ncan help reduce licensing costs without reducing Persistent Disk performance limits.\nHowever, reducing the number of visible CPU cores might affect network\nperformance.\n| **Note:** Reducing the number of visible CPU cores for a VM might impact the performance of the VM. For more information, see [Performance considerations](/compute/docs/instances/customize-visible-cores#performance_considerations).\n\nBefore you begin\n----------------\n\n- If you haven't already, set up [authentication](/compute/docs/authentication). Authentication verifies your identity for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine by selecting one of the following options:\n\n Select the tab for how you plan to use the samples on this page: \n\n ### Console\n\n\n When you use the Google Cloud console to access Google Cloud services and\n APIs, you don't need to set up authentication.\n\n ### gcloud\n\n 1.\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n After installation,\n [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command:\n\n ```bash\n gcloud init\n ```\n\n\n If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n | **Note:** If you installed the gcloud CLI previously, make sure you have the latest version by running `gcloud components update`.\n 2. [Set a default region and zone](/compute/docs/gcloud-compute#set_default_zone_and_region_in_your_local_client).\n\n ### REST\n\n\n To use the REST API samples on this page in a local development environment, you use the\n credentials you provide to the gcloud CLI.\n 1. [Install](/sdk/docs/install) the Google Cloud CLI. After installation, [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command: \n\n ```bash\n gcloud init\n ```\n 2. If you're using an external identity provider (IdP), you must first [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n\n For more information, see\n [Authenticate for using REST](/docs/authentication/rest)\n in the Google Cloud authentication documentation.\n\n### Required roles\n\n\nTo get the permission that\nyou need to view the details of a VM,\n\nask your administrator to grant you the\n\n\n[Compute Instance Admin (v1)](/iam/docs/roles-permissions/compute#compute.instanceAdmin.v1) (`roles/compute.instanceAdmin.v1`)\nIAM role on the VM or project.\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nThis predefined role contains the\n` compute.instances.get`\npermission,\nwhich is required to\nview the details of a VM.\n\n\nYou might also be able to get\nthis permission\nwith [custom roles](/iam/docs/creating-custom-roles) or\nother [predefined roles](/iam/docs/roles-overview#predefined).\n\nView the number of visible CPU cores for a VM\n---------------------------------------------\n\nTo determine if the number of visible CPU cores was customized for a VM, select\none of the following options: \n\n### Console\n\n1. In the Google Cloud console, go to the **VM instances** page.\n\n [Go to VM instances](https://console.cloud.google.com/compute/instances)\n2. In the **Name** column, click the name of\n the VM.\n\n The details page of the VM opens and the **Details** tab is selected.\n3. In the **Machine configuration** section, check the value for\n **Custom visible cores** . If there is no value displayed, then the VM\n has the\n [default number of visible CPU cores](/compute/docs/instances/customize-visible-cores).\n\n### gcloud\n\nTo view the details of the VM, use the\n[`gcloud compute instances describe` command](/sdk/gcloud/reference/compute/instances/describe). \n\n gcloud compute instances describe \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e \\\n --zone=\u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e: the name of the VM.\n\n- \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the zone where the VM is located.\n\nIf the number of visible CPU cores for the VM was customized, then\nthe output contains the `visibleCoreCount` field as follows: \n\n advancedMachineFeatures:\n visibleCoreCount: \u003cvar translate=\"no\"\u003eVISIBLE_CORE_COUNT\u003c/var\u003e\n ...\n\nIf the output doesn't contain the `visibleCoreCount` field, then\nthe VM has the\n[default number of visible CPU cores](/compute/docs/instances/customize-visible-cores).\n\n### REST\n\nTo view the details of the VM, make a `GET` request to the\n[`instances.get` method](/compute/docs/reference/rest/v1/instances/get). \n\n GET https://compute.googleapis.com/compute/v1/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/zones/\u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e/instances/\u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of the project where the VM is\n located.\n\n- \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the zone where the VM is located.\n\n- \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e: the name of the VM.\n\nIf the number of visible CPU cores for the VM was customized, then\nthe output contains the `visibleCoreCount` field as follows: \n\n {\n ...\n \"advancedMachineFeatures\": {\n visibleCoreCount: \u003cvar translate=\"no\"\u003eVISIBLE_CORE_COUNT\u003c/var\u003e\n },\n ...\n }\n\nIf the output doesn't contain the `visibleCoreCount` field, then\nthe VM has the\n[default number of visible CPU cores](/compute/docs/instances/customize-visible-cores).\n\nWhat's next\n-----------\n\n- [Customize the number of visible cores](/compute/docs/instances/customize-visible-cores)\n- [Set the number of threads per core](/compute/docs/instances/set-threads-per-core)"]]