Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Linux
Windows
Este documento descreve como conferir o número de núcleos de CPU visíveis para uma
instância de máquina virtual (VM).
Ao
acessar os detalhes de uma VM,
é possível verificar se ela tem o número padrão de núcleos de CPU visíveis ou se esse
número foi personalizado. Reduzir o número de núcleos de CPU visíveis para uma VM
pode ajudar a reduzir os custos de licenciamento sem reduzir os limites de desempenho do disco persistente.
No entanto, reduzir o número de núcleos de CPU visíveis pode afetar o desempenho
da rede.
Antes de começar
Configure a autenticação, caso ainda não tenha feito isso.
A autenticação é
o processo de verificação da sua identidade para acesso a serviços e APIs do Google Cloud .
Para executar códigos ou amostras de um ambiente de desenvolvimento local, autentique-se no
Compute Engine selecionando uma das seguintes opções:
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
Instale a CLI do Google Cloud.
Após a instalação,
inicialize a Google Cloud CLI executando o seguinte comando:
A página de detalhes da VM é aberta e a guia Detalhes é selecionada.
Na seção Configuração da máquina, verifique o valor de
Cores visíveis personalizadas. Se nenhum valor for exibido, a VM
terá o
número padrão de núcleos de CPU visíveis.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-18 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)"]]