/////////////////////////////////////////////////////////////////////////////// // // Microsoft Research Singularity // // Copyright (c) Microsoft Corporation. All rights reserved. // // File: ProcessContract.sg // Note: Contract definition for the process diagnostic module // using Microsoft.Singularity.Directory; using Microsoft.Singularity.Channels; namespace Microsoft.Singularity.Diagnostics.Contracts { public contract ProcessContract : ServiceContract { // The name you should use to look up this module using the NameServer. public const string ModuleName = "/process-diagnostics"; // Signal our identity out message Ready(); // Retrieve the list of processes in message GetProcessIDs(); out message ProcessIDs(int[]! in ExHeap IDs); // Retrieve a process name in message GetProcessName(int procID); out message ProcessName(char[]! in ExHeap procName); // Retrieve the threadID set for a given a process in message GetProcessThreadIDs(int procID); out message ProcessThreadIDs(int[]! in ExHeap tids); // Retrieve the process times for a given process in message GetProcessTimes(int procID); out message ProcessTimes(long totalTime, long deadThreadTime, long deadThreadCount); // Retrieve the stats for a given Process in message GetProcessGcStats(int procID); out message ProcessGcStats(int count, long time, long bytes); // Process not found out message NotFound(); override state Start : one { Ready! -> ReadyState; } state ReadyState : one { GetProcessIDs? -> ProcessIDs! -> ReadyState; GetProcessThreadIDs? -> (ProcessThreadIDs! or NotFound!) -> ReadyState; GetProcessTimes? -> (ProcessTimes! or NotFound!) -> ReadyState; GetProcessGcStats? -> (ProcessGcStats! or NotFound!) -> ReadyState; GetProcessName? -> (ProcessName! or NotFound!) -> ReadyState; } } }