profile method

Future<Map<String, dynamic>> profile({
  1. String? output,
  2. List<String>? collectors,
  3. String? profileTime,
  4. int? mutexProfileFraction,
  5. String? blockProfileRate,
})

Collect a performance profile for debugging. /api/v0/diag/profile

Optional arguments:

  • output String: The path where the output .zip should be stored. Default: ./ipfs-profile-timestamp.zip.
  • collectors List: The list of collectors to use for collecting diagnostic data. Default: goroutines-stack, goroutines-pprof, version, heap, bin, cpu, mutex, block.
  • profileTime String: The amount of time spent profiling. If this is set to 0, then sampling profiles are skipped. Default: 30s.
  • mutexProfileFraction int: The fraction 1/n of mutex contention events that are reported in the mutex profile. Default: 4.
  • blockProfileRate String: The duration to wait between sampling goroutine-blocking events for the blocking profile. Default: 1ms.

Response:

{
  "Text": "<text/plain response>",
  "StatusCode": "<statusCode>",
  "StatusMessage": "<statusMessage>"
}

See more: https://docs.ipfs.io/reference/http/api/#api-v0-diag-profile

Implementation

Future<Map<String, dynamic>> profile({
  String? output,
  List<String>? collectors,
  String? profileTime,
  int? mutexProfileFraction,
  String? blockProfileRate,
}) async {
  Response? res = await _post(
    Ipfs.dio,
    url: "${Ipfs.url}/diag/profile",
    queryParameters: {
      if (output != null) "output": output,
      if (collectors != null) "collectors": "[${collectors.join(" ")}]",
      if (profileTime != null) "profile-time": profileTime,
      if (mutexProfileFraction != null)
        "mutex-profile-fraction": mutexProfileFraction,
      if (blockProfileRate != null) "block-profile-rate": blockProfileRate,
    },
  );

  return _interceptDioResponse(res);
}