# IManagementGrain Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.runtime.imanagementgrain/)

## ForceActivationCollection(SiloAddress[], TimeSpan) {#forceactivationcollection-orleans-runtime-siloaddress-array-1-system-timespan-fb3e7edb}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.runtime.imanagementgrain/methods/forceactivationcollection-orleans-runtime-siloaddress-array-1-system-timespan-fb3e7edb/)

```csharp
public abstract Task ForceActivationCollection(SiloAddress[] hostsIds, TimeSpan ageLimit)
```

Perform a run of the Orleans activation collector in the specified silos.

### Parameters

- `hostsIds` (`SiloAddress[]`): List of silos this command is to be sent to.
- `ageLimit` (`TimeSpan`): Maximum idle time of activations to be collected.

### Returns

A `System.Threading.Tasks.Task` representing the work performed.

## ForceActivationCollection(TimeSpan) {#forceactivationcollection-system-timespan-e042b0b5}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.runtime.imanagementgrain/methods/forceactivationcollection-system-timespan-e042b0b5/)

```csharp
public abstract Task ForceActivationCollection(TimeSpan ageLimit)
```

Forces activation collection.

### Parameters

- `ageLimit` (`TimeSpan`): The age limit. Grains which have been idle for longer than this period of time will be eligible for collection.

### Returns

A `System.Threading.Tasks.Task` representing the work performed.

## ForceGarbageCollection(SiloAddress[]) {#forcegarbagecollection-orleans-runtime-siloaddress-array-1-d8249777}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.runtime.imanagementgrain/methods/forcegarbagecollection-orleans-runtime-siloaddress-array-1-d8249777/)

```csharp
public abstract Task ForceGarbageCollection(SiloAddress[] hostsIds)
```

Perform a run of the .NET garbage collector in the specified silos.

### Parameters

- `hostsIds` (`SiloAddress[]`): List of silos this command is to be sent to.

### Returns

A `System.Threading.Tasks.Task` representing the work performed.

## ForceRuntimeStatisticsCollection(SiloAddress[]) {#forceruntimestatisticscollection-orleans-runtime-siloaddress-array-1-334281a9}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.runtime.imanagementgrain/methods/forceruntimestatisticscollection-orleans-runtime-siloaddress-array-1-334281a9/)

```csharp
public abstract Task ForceRuntimeStatisticsCollection(SiloAddress[] siloAddresses)
```

Perform a run of the silo statistics collector in the specified silos.

### Parameters

- `siloAddresses` (`SiloAddress[]`): List of silos this command is to be sent to.

### Returns

A `System.Threading.Tasks.Task` representing the work performed.

## GetActivationAddress(IAddressable) {#getactivationaddress-orleans-runtime-iaddressable-e6324125}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.runtime.imanagementgrain/methods/getactivationaddress-orleans-runtime-iaddressable-e6324125/)

```csharp
public abstract ValueTask<SiloAddress> GetActivationAddress(IAddressable reference)
```

Return the [SiloAddress](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.siloaddress/) where a given Grain is activated (if any).

### Parameters

- `reference` (`IAddressable`): The [IAddressable](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.iaddressable/) to look up.

### Returns

The [SiloAddress](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.siloaddress/) where the Grain is activated or null if not activated taken from a snapshot of the last known state of the Grain Catalog.

## GetActiveGrains(GrainType) {#getactivegrains-orleans-runtime-graintype-ce18aee3}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.runtime.imanagementgrain/methods/getactivegrains-orleans-runtime-graintype-ce18aee3/)

```csharp
public abstract ValueTask<List<GrainId>> GetActiveGrains(GrainType type)
```

Returns all activations of the specified grain type.

### Parameters

- `type` (`GrainType`): The type.

### Returns

A list of all active grains of the specified type.

## GetDetailedGrainStatistics(string[], SiloAddress[]) {#getdetailedgrainstatistics-string-array-1-orleans-runtime-siloaddress-array-1-eabed09e}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.runtime.imanagementgrain/methods/getdetailedgrainstatistics-string-array-1-orleans-runtime-siloaddress-array-1-eabed09e/)

```csharp
public abstract Task<DetailedGrainStatistic[]> GetDetailedGrainStatistics(string[] types = null, SiloAddress[] hostsIds = null)
```

Returns the most recent detailed grain statistics information, amalgamated across silos for the specified types.

### Parameters

- `types` (`string[]`): Array of grain types to filter the results with
- `hostsIds` (`SiloAddress[]`): List of silos this command is to be sent to.

### Returns

Detailed grain statistics.

## GetDetailedHosts(bool) {#getdetailedhosts-bool-9241dede}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.runtime.imanagementgrain/methods/getdetailedhosts-bool-9241dede/)

```csharp
public abstract Task<MembershipEntry[]> GetDetailedHosts(bool onlyActive = false)
```

Get the list of silo hosts and membership information currently known about in this cluster.

### Parameters

- `onlyActive` (`bool`): Whether data on just current active silos should be returned, or by default data for all current and previous silo instances [including those in Joining or Dead status].

### Returns

The host entries.

## GetGrainActivationCount(GrainReference) {#getgrainactivationcount-orleans-runtime-grainreference-9315df3e}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.runtime.imanagementgrain/methods/getgrainactivationcount-orleans-runtime-grainreference-9315df3e/)

```csharp
public abstract Task<int> GetGrainActivationCount(GrainReference grainReference)
```

Gets the grain activation count for a specific grain type.

### Parameters

- `grainReference` (`GrainReference`): The grain reference.

### Returns

Gets the number of activations of grains with the same type as the provided grain reference.

## GetGrainCallFrequencies(SiloAddress[]) {#getgraincallfrequencies-orleans-runtime-siloaddress-array-1-565dfbff}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.runtime.imanagementgrain/methods/getgraincallfrequencies-orleans-runtime-siloaddress-array-1-565dfbff/)

```csharp
public abstract Task<List<GrainCallFrequency>> GetGrainCallFrequencies(SiloAddress[] hostsIds = null)
```

Gets estimated grain call frequency statistics from the specified hosts.

### Parameters

- `hostsIds` (`SiloAddress[]`): The hosts to request grain call frequency counts from.

### Returns

A list of estimated grain call frequencies.

## GetHosts(bool) {#gethosts-bool-d59a8758}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.runtime.imanagementgrain/methods/gethosts-bool-d59a8758/)

```csharp
public abstract Task<Dictionary<SiloAddress, SiloStatus>> GetHosts(bool onlyActive = false)
```

Get the list of silo hosts and statuses currently known about in this cluster.

### Parameters

- `onlyActive` (`bool`): Whether data on just current active silos should be returned, or by default data for all current and previous silo instances [including those in Joining or Dead status].

### Returns

The hosts and their corresponding statuses.

## GetRuntimeStatistics(SiloAddress[]) {#getruntimestatistics-orleans-runtime-siloaddress-array-1-563938b6}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.runtime.imanagementgrain/methods/getruntimestatistics-orleans-runtime-siloaddress-array-1-563938b6/)

```csharp
public abstract Task<SiloRuntimeStatistics[]> GetRuntimeStatistics(SiloAddress[] hostsIds)
```

Return the most recent silo runtime statistics information for the specified silos.

### Parameters

- `hostsIds` (`SiloAddress[]`): List of silos this command is to be sent to.

### Returns

Runtime statistics from the specified hosts.

## GetSimpleGrainStatistics {#getsimplegrainstatistics-cf4b22f4}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.runtime.imanagementgrain/methods/getsimplegrainstatistics-cf4b22f4/)

```csharp
public abstract Task<SimpleGrainStatistic[]> GetSimpleGrainStatistics()
```

Return the most recent grain statistics information, amalgamated across all silos.

### Returns

Simple grain statistics.

## GetSimpleGrainStatistics(SiloAddress[]) {#getsimplegrainstatistics-orleans-runtime-siloaddress-array-1-39e22b6e}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.runtime.imanagementgrain/methods/getsimplegrainstatistics-orleans-runtime-siloaddress-array-1-39e22b6e/)

```csharp
public abstract Task<SimpleGrainStatistic[]> GetSimpleGrainStatistics(SiloAddress[] hostsIds)
```

Return the most recent grain statistics information, amalgamated across silos.

### Parameters

- `hostsIds` (`SiloAddress[]`): List of silos this command is to be sent to.

### Returns

Simple grain statistics for the specified hosts.

## GetTotalActivationCount {#gettotalactivationcount-84b4c5d7}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.runtime.imanagementgrain/methods/gettotalactivationcount-84b4c5d7/)

```csharp
public abstract Task<int> GetTotalActivationCount()
```

Return the total count of all current grain activations across all silos.

### Returns

The total number of grain activations across all silos.

## ResetGrainCallFrequencies(SiloAddress[]) {#resetgraincallfrequencies-orleans-runtime-siloaddress-array-1-a104baec}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.runtime.imanagementgrain/methods/resetgraincallfrequencies-orleans-runtime-siloaddress-array-1-a104baec/)

```csharp
public abstract ValueTask ResetGrainCallFrequencies(SiloAddress[] hostsIds = null)
```

For testing only. Resets grain call frequency counts on the specified hosts.

### Parameters

- `hostsIds` (`SiloAddress[]`): The hosts to invoke the operation on.

### Returns

A task representing the work performed.

## SendControlCommandToProvider(string, int, object) {#sendcontrolcommandtoprovider-1-string-int-object-e13038b2}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.runtime.imanagementgrain/methods/sendcontrolcommandtoprovider-1-string-int-object-e13038b2/)

```csharp
public abstract Task<object[]> SendControlCommandToProvider<T>(string providerName, int command, object arg = null)
```

Execute a control command on the specified providers on all silos in the cluster. Commands are sent to all known providers on each silo which match both the `providerTypeFullName` AND `providerName` parameters.

### Parameters

- `providerName` (`string`): Provider name to send this command to.
- `command` (`int`): An id / serial number of this command. This is an opaque value to the Orleans runtime - the control protocol semantics are decided between the sender and provider.
- `arg` (`object`): An opaque command argument. This is an opaque value to the Orleans runtime - the control protocol semantics are decided between the sender and provider.

### Returns

Completion promise for this operation.
