Class DataBufferPool
A data buffer pool.
Inheritance
Implements
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public class DataBufferPool : IDataBufferPool
Constructors
DataBufferPool()
Initializes a new instance of the DataBufferPool class.
Declaration
public DataBufferPool()
DataBufferPool(String)
Initializes a new instance of the DataBufferPool class.
Declaration
public DataBufferPool(string tag)
Parameters
Type | Name | Description |
---|---|---|
System.String | tag | The tag for stats output. |
Properties
BlockSize
Gets or sets the block size.
Declaration
public int BlockSize { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Disabled
Gets or sets whether the pool is disabled. If disabled, each call to take a buffer will result in a new allocation.
Declaration
public bool Disabled { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
EnableStatistics
Gets or sets whether to enable statistics.
Declaration
public bool EnableStatistics { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Instance
Gets the singleton instance.
Declaration
public static DataBufferPool Instance { get; }
Property Value
Type | Description |
---|---|
DataBufferPool |
IsSupported
Gets a value indicating whether DataBuffer pooling is supported on this platform.
Declaration
public static bool IsSupported { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Statistics
Gets the pool usage statistics.
Declaration
public PoolStatistics Statistics { get; }
Property Value
Type | Description |
---|---|
PoolStatistics |
TraceStatistics
Gets all tagged pool usage statistics.
Declaration
public PoolStatistics[] TraceStatistics { get; }
Property Value
Type | Description |
---|---|
PoolStatistics[] |
Methods
GetTracer(String)
Get a data buffer pool tracer for a specific tag using the default pool.
Declaration
public static DataBufferPoolTracer GetTracer(string tag)
Parameters
Type | Name | Description |
---|---|---|
System.String | tag | The tag to log to. |
Returns
Type | Description |
---|---|
DataBufferPoolTracer | A tracer that will associate stats with the type. |
GetTracer(String, DataBufferPool)
Get a data buffer pool tracer for a specific tag and pool.
Declaration
public static DataBufferPoolTracer GetTracer(string tag, DataBufferPool pool)
Parameters
Type | Name | Description |
---|---|---|
System.String | tag | The tag to log to. |
DataBufferPool | pool | The underlying pool. |
Returns
Type | Description |
---|---|
DataBufferPoolTracer | A tracer that will associate stats with the type. |
GetTracer(Type)
Get a data buffer pool tracer for a specific tag using the default pool. The tag is taken from the class namespace and name.
Declaration
public static DataBufferPoolTracer GetTracer(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The type to use as the tag. |
Returns
Type | Description |
---|---|
DataBufferPoolTracer | A tracer that will associate stats with the tag. |
GetTracer(Type, DataBufferPool)
Get a data buffer pool tracer for a specific tag and pool. The tag is taken from the class namespace and name.
Declaration
public static DataBufferPoolTracer GetTracer(Type type, DataBufferPool pool)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The type to use as the tag. |
DataBufferPool | pool | The underlying pool. |
Returns
Type | Description |
---|---|
DataBufferPoolTracer | A tracer that will associate stats with the tag. |
GetTraceStatistics(String)
Gets pool usage statistics for a specific tag.
Declaration
public PoolStatistics GetTraceStatistics(string tag)
Parameters
Type | Name | Description |
---|---|---|
System.String | tag | The tag. |
Returns
Type | Description |
---|---|
PoolStatistics |
GetTraceStatistics(Type)
Gets pool usage statistics for a specific tag.
Declaration
public PoolStatistics GetTraceStatistics(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The type to use as the tag. |
Returns
Type | Description |
---|---|
PoolStatistics |
Take(Int32)
Takes a buffer from the pool.
Declaration
public DataBuffer Take(int size)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | size | The number of bytes needed. |
Returns
Type | Description |
---|---|
DataBuffer |
Take(Int32, Boolean)
Takes a buffer from the pool.
Declaration
public DataBuffer Take(int size, bool littleEndian)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | size | The number of bytes needed. |
System.Boolean | littleEndian | Whether the data buffer should be little-endian. |
Returns
Type | Description |
---|---|
DataBuffer |
Take(Int32, Boolean, Boolean)
Takes a buffer from the pool.
Declaration
public DataBuffer Take(int size, bool littleEndian, bool clearBytes)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | size | The number of bytes needed. |
System.Boolean | littleEndian | Whether the data buffer should be little-endian. |
System.Boolean | clearBytes | Whether to clear the data buffer. |
Returns
Type | Description |
---|---|
DataBuffer |