# Google Cloud Profiler V2 Client - Class Profile (2.1.2)

2.1.2 (latest) 2.1.1 2.0.4 1.4.3 1.3.0 1.2.4 1.1.1 1.0.3 Reference documentation and code samples for the Google Cloud Profiler V2 Client class Profile.

Profile resource.

Generated from protobuf message `google.devtools.cloudprofiler.v2.Profile`

## Namespace

Google \\ Cloud \\ Profiler \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Output only. Opaque, server-assigned, unique ID for this profile. |
| `↳ profile_type` | `int` Type of profile. For offline mode, this must be specified when creating the profile. For online mode it is assigned and returned by the server. |
| `↳ deployment` | `https://docs.cloud.google.com/php/docs/reference/cloud-profiler/latest/V2.Deployment` Deployment this profile corresponds to. |
| `↳ duration` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` Duration of the profiling session. Input (for the offline mode) or output (for the online mode). The field represents requested profiling duration. It may slightly differ from the effective profiling duration, which is recorded in the profile data, in case the profiling can't be stopped immediately (e.g. in case stopping the profiling is handled asynchronously). |
| `↳ profile_bytes` | `string` Input only. Profile bytes, as a gzip compressed serialized proto, the format is <https://github.com/google/pprof/blob/master/proto/profile.proto>. |
| `↳ labels` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Input only. Labels associated to this specific profile. These labels will get merged with the deployment labels for the final data set. See documentation on deployment labels for validation rules and limits. |
| `↳ start_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. Start time for the profile. This output is only present in response from the ListProfiles method. |

### getName

Output only. Opaque, server-assigned, unique ID for this profile.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

Output only. Opaque, server-assigned, unique ID for this profile.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getProfileType

Type of profile.

For offline mode, this must be specified when creating the profile. For
online mode it is assigned and returned by the server.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [ProfileType](https://docs.cloud.google.com/php/docs/reference/cloud-profiler/latest/V2.ProfileType). |

### setProfileType

Type of profile.

For offline mode, this must be specified when creating the profile. For
online mode it is assigned and returned by the server.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [ProfileType](https://docs.cloud.google.com/php/docs/reference/cloud-profiler/latest/V2.ProfileType). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDeployment

Deployment this profile corresponds to.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-profiler/latest/V2.Deployment|null` |   |

### hasDeployment

### clearDeployment

### setDeployment

Deployment this profile corresponds to.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-profiler/latest/V2.Deployment` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDuration

Duration of the profiling session.

Input (for the offline mode) or output (for the online mode).
The field represents requested profiling duration. It may slightly differ
from the effective profiling duration, which is recorded in the profile
data, in case the profiling can't be stopped immediately (e.g. in case
stopping the profiling is handled asynchronously).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration|null` |   |

### hasDuration

### clearDuration

### setDuration

Duration of the profiling session.

Input (for the offline mode) or output (for the online mode).
The field represents requested profiling duration. It may slightly differ
from the effective profiling duration, which is recorded in the profile
data, in case the profiling can't be stopped immediately (e.g. in case
stopping the profiling is handled asynchronously).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getProfileBytes

Input only. Profile bytes, as a gzip compressed serialized proto, the
format is <https://github.com/google/pprof/blob/master/proto/profile.proto>.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setProfileBytes

Input only. Profile bytes, as a gzip compressed serialized proto, the
format is <https://github.com/google/pprof/blob/master/proto/profile.proto>.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getLabels

Input only. Labels associated to this specific profile. These labels will
get merged with the deployment labels for the final data set. See
documentation on deployment labels for validation rules and limits.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |   |

### setLabels

Input only. Labels associated to this specific profile. These labels will
get merged with the deployment labels for the final data set. See
documentation on deployment labels for validation rules and limits.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getStartTime

Output only. Start time for the profile.

This output is only present in response from the ListProfiles method.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasStartTime

### clearStartTime

### setStartTime

Output only. Start time for the profile.

This output is only present in response from the ListProfiles method.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |