C3 AI Documentation Home

Console Reference: c3Time

c3Time measures the time taken to run a specified function. For accurate results, the function should be synchronous (as in, it should not return a Promise).

Parameters

NameRequiredTypeDescription
funcFunctionThe function to be measured.
promptFunction | stringA label or action, such as "Completed", or a function that returns a label

Example

Measure the amount of time it takes to run a computationally intensive function:

JavaScript

// An example computation-intensive function
const fetchExtensiveData = () => { /* ... */ }

// Measure the execution time with 'c3Time'
c3Time(fetchExtensiveData, "Fetch data for nested Types"); 

// Example output:
// Fetch data for nested Types in 5780ms

See also

Was this page helpful?