文档应用

本页面提供了有关使用 Cloud Shell 从 GitHub golang-samples/profiler 代码库下载和运行示例的指南。您还可以在Google Cloud之外运行这些示例。如需了解这种情况所需的其他配置步骤,请参阅剖析在 Google Cloud外部运行的应用的性能

如果您选择运行这些程序,则可以快速创建性能剖析数据,以用于探索 Cloud Profiler 界面的功能。 您还可以修改这些示例的副本,然后使用 Cloud Profiler 界面重新部署和分析更改所带来的影响。

准备工作

  1. 登录您的 Google Cloud 账号。如果您是 Google Cloud新手,请 创建一个账号来评估我们的产品在实际场景中的表现。新客户还可获享 $300 赠金,用于运行、测试和部署工作负载。
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Enable the Cloud Profiler API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API