dotMemory 2019.2 Help

API Reference

MemoryProfiler class methods

Item

Returns

Description

GetFeatures() enum MemoryFeatures: uint

Returns a set of features currently active in the profiler: Bit flags in the MemoryFeatures value fully describe the current profiler state. Each bit indicates whether a corresponding feature is currently available:

  • Ready = 0x1: Indicates whether the profiler is ready to work. You need to check this flag only in case you attach the profiler to the current process: the flag will be set once the profiler is ready to accept your commands. If you start a process under profiling, this flag is always set. After you detach the profiler from the process, the flag is cleared.

  • Detach = 0x2: Indicates whether it is possible to use MemoryProfiler.Detach().
    0: the profiler will ignore MemoryProfiler.Detach().
    1: MemoryProfiler.Detach() will detach the profiler from the profiled process.

  • CollectAllocations = 0x4: Indicates whether it is possible to use CollectAllocations(bool enabled). If 0, the profiler ignores the CollectAllocations call. If 1, the CollectAllocations call will take effect.

GetSnapshot()

Collect memory snapshot and save it to the disk. This method forces full garbage collection.
Doesn't throw any errors even if the application is run with profiling disabled.

GetSnapshot(string name)

[Internal use only]
Collect memory snapshot and save it to the disk. This method forces full garbage collection.
Doesn't throw any errors even if the application is run with profiling disabled.
name is the name of the memory snapshot. It is not a filename.

ForceGc()

Forces full garbage collection.
Doesn't throw any errors even if the application is run with profiling disabled.

CollectAllocations(bool enable)

Enable/disable collecting memory allocation data. Does nothing if collecting allocation data is disabled in the profiler. To check whether the collecting is enabled, use MemoryProfiler.GetFeatures().
Doesn't throw any errors even if the application is run with profiling disabled.

Detach()

Detach the profiler from the profiled process. Does nothing if detaching is disabled in the profiler. To check whether the detaching is enabled, use MemoryProfiler.GetFeatures() with MemoryFeatures.Detach flag. Doesn't throw any errors even if the application is run with profiling disabled.

SelfAttach class properties

Item

Type

Description

State enum SelfApiState {None, Inactive, Active}

Indicates the profiler state.

  • None: the profiler is not available.

  • Inactive: the profiler is available. Profiling control is not available.

  • Active: the profiler is available. Profiling can be controlled via API or the controller window.

SelfAttach class methods

Item

Description

Attach(BaseProfilingConfig baseConfig)

Attaches the profiler to the calling application with supplied configuration baseConfig.

Show()

Shows the profiling controller to a user.

BaseProfilingConfig class public fields

Item

Type

Description

ProfilingControlKind enum ProfilingControlKind {None, Manual, Api}

Defines the profiling control method.

  • None: no control.

  • Manual: control through the Controller window.

  • Api: control through API.

ProfilingType enum ProfilingType {Performance, Memory, Timeline}

Defines the profiling method.

  • Performance: performance profiling (used by the dotTrace profiler).

  • Memory: memory profiling.

  • Timeline: timeline profiling (used by the dotTrace profiler).

PerformaceMeterKind enum PerformaceMeterKind {Rdtsc, PerformanceCounter, ThreadTime, ThreadCycleTime}

[Used for performance profiling only] Defines the time measurement method.

  • Rdtsc: real time (CPU instruction).

  • PerformanceCounter: real time (performance counter).

  • ThreadTime: thread time.

  • ThreadCycleTime: thread cycle time.

RedistDir string

Defines location of dotMemory SDK redistributables. By default, they are searched in the same folder where JetBrains.Profiler.Windows.Api.dll is located.

BaseSnapshotProfilingConfig class public fields

Item

Type

Description

SaveDir string

Defines a path and a base file name for the resulting snapshot. Required for this configuration.

SnapshotFormat enum {Compressed, Uncompressed}

Defines a file format for a snapshot: compressed or uncompressed. By default, it is compressed.

SaveSnapshotProfilingConfig class public fields

Item

Type

Description

ListFile string

Defines a file name for a file which lists snapshots collected during profiling. Required for this configuration.
Do NOT create this file manually, it will be created automatically during profiling!
Do NOT open this file until the SelfAttach.State is in the None state!

ExecutableSnapshotProfilingConfig class public fields

Item

Type

Description

Executable string

Defines the path to the executable file to run after profiling is completed. The snapshot path will be passed as a parameter to this executable file. Required for this configuration.

Last modified: 8 August 2019

See Also