Kanzi  3.9.5
Java API
ProfileScope Class Reference

The ProfileScope is used to trace a scope in the Kanzi profiler. More...

Inheritance diagram for ProfileScope:
[legend]

Public Member Functions

 ProfileScope (String name)
 Constructs a ProfileScope object. More...
 
void close ()
 Stop measuring the scope and send the total time to the profiler.
 

Static Public Member Functions

static void run (String name, Runnable r)
 Run some code within a Profile Scope. More...
 

Detailed Description

The ProfileScope is used to trace a scope in the Kanzi profiler.

It is intended to be used with a try-with-resources block, the ProfileScope#run(String, Runnable) method, or manual calling of the ProfileScope#close() method.

By default these traces are disabled. To enable, add either of the following to the application.cfg file. ProfilingCategoryFilter = "*=on" OR ProfilingCategoryFilter = "Interop=on"

To suppress the warning about the scope being an unused variable use: ("try")

Constructor & Destructor Documentation

◆ ProfileScope()

ProfileScope ( String  name)

Constructs a ProfileScope object.

When it is closed, the time between construction and close is reported to the Kanzi profile subsystem.

Parameters
name

Member Function Documentation

◆ run()

static void run ( String  name,
Runnable  r 
)
static

Run some code within a Profile Scope.

Parameters
nameThe name of the profile scope.
rThe runnable to run.