---
schema_version: "1"
id: 50559fbb410c8de2bb86498f7dd693dd7ea32c21fa102c6baaa978255789dd92
title: duration
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.5/dw-timer-functions-duration.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.5/dw-timer-functions-duration
source_site: docs.mulesoft.com
content_type: documentation
content_hash: d3baf1c42cc5f1968753c673303ca9f5b6dab45286727040b78b882408394dfd
description: MuleSoft Documentation Site
release: "2.5"
latest: false
---
# duration

## [](#duration1)duration<T>(valueToMeasure: () -> T): DurationMeasurement<T>

入力関数を実行し、その関数の実行時間 (ミリ秒) と結果を含むオブジェクトを返します。

### [](#パラメーター)パラメーター

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 75%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">名前</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>valueToMeasure</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>duration</code>​ に渡す関数。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例では、​`wait`​ 関数 (ヘッダーで定義) を渡し、その関数の実行時間と結果を ​`DurationMeasurement`​ オブジェクトで返します。

#### [](#ソース)ソース

```Dataweave
%dw 2.0
output application/json
fun myFunction() = dw::Runtime::wait("My result",100)
---
dw::util::Timer::duration(() -> myFunction())
```

#### [](#出力)出力

```XML
{
  "time": 101,
  "result": "My result"
}
```