//
//
//
//
// $Revision$
//
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using ICSharpCode.Profiler.Controller.Data;
namespace ICSharpCode.Profiler.Controller
{
///
/// Holds all settings for the profiler chosen by the user.
///
public class ProfilerOptions
{
///
/// Defines the default size of the shared memory.
///
public const int DefaultSharedMemorySize = 64 * 1024 * 1024; // 64 mb
public static readonly PerformanceCounterDescriptor[] DefaultCounters = new[] {
new PerformanceCounterDescriptor("Process", "% Processor Time", "_Total", ".", 0, 0, 100, "%"),
new PerformanceCounterDescriptor("Process", "IO Data Bytes/sec", "_Total", ".", 0, null, null, "bytes/sec")
};
bool enableDC;
bool enableDCAtStart;
bool dotNotProfileDotNetInternals;
bool combineRecursiveFunction;
int sharedMemorySize;
PerformanceCounterDescriptor[] counters;
public PerformanceCounterDescriptor[] Counters {
get { return this.counters; }
}
///
/// Gets whether .NET internal calls are profiled or not.
///
public bool DoNotProfileDotNetInternals {
get { return dotNotProfileDotNetInternals; }
}
///
/// Gets whether recursive functions calls are combined or not.
///
public bool CombineRecursiveFunction {
get { return combineRecursiveFunction; }
}
///
/// Gets whether data collection is enabled during profiling sessions.
///
public bool EnableDC {
get { return enableDC; }
}
///
/// Gets whether data collection is enabled at the start of the profiling session.
///
public bool EnableDCAtStart {
get { return enableDCAtStart; }
}
///
/// Gets the size of the shared memory.
///
public int SharedMemorySize {
get { return sharedMemorySize; }
}
///
/// Creates new ProfilerOptions using the selected settings.
///
public ProfilerOptions(bool enableDC, int sharedMemorySize, bool profileDotNetInternals,
bool combineRecursiveFunction, bool enableDCAtStart, IEnumerable counters)
{
this.enableDC = enableDC;
this.sharedMemorySize = sharedMemorySize;
this.dotNotProfileDotNetInternals = profileDotNetInternals;
this.combineRecursiveFunction = combineRecursiveFunction;
this.enableDCAtStart = enableDCAtStart;
this.counters = counters.ToArray();
}
///
/// Creates default ProfilerOptions.
///
public ProfilerOptions()
: this(true, DefaultSharedMemorySize, false, false, true, DefaultCounters)
{
}
}
}