> For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt.

# profileStart()

APISummary
标记一个 [trace event](https://perfetto.dev/docs/instrumentation/track-events)
的开始。

## 语法

```typescript
profileStart(name: string, option?: { flowId: number, arg?:  Record<string, string>}): void;
```

## 参数

##### `name`

trace event 的名称。

##### `option`（可选）

额外选项，例如 `flowId` 和自定义参数（`arg`）。

## 示例

```typescript
// 开始一个 trace event。
lynx.performance.profileStart('DataFetch');

// 开始一个 trace event 并添加自定义参数
lynx.performance.profileStart('DataFetch', {
  args: { url: 'https://api.example.com/data', method: 'GET' },
});

// 开始一个 flow 类型的 trace event
const flowId = lynx.performance.profileFlowId();
lynx.performance.profileStart('UserAction', { flowId });

// 开始一个 flow 类型的 trace event 并添加自定义参数
lynx.performance.profileStart('ComplexProcess', {
  args: { step: 'start' },
  flowId,
});
```

## 兼容性

**Compatibility Table**

**Query:** `lynx-api.lynx.performance.profileStart()`

[Source](https://github.com/lynx-family/lynx-website/tree/main/packages/lynx-compat-data/lynx-api/lynx/performance.json)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| profileStart() | Yes (3.3) | Unknown | Yes (3.3) | Yes (3.5) | Yes (3.5) | Yes |

**`profileStart()`**

- **Web — Supported (version unknown):** Implemented since `@lynx-js/web-core@0.22.0` (lynx-family/lynx-stack#2874).

