static public FromInterfaceResponse MeasurementTakeRequest( this InterfaceAppManager interfaceAppManager, int processId, Int64 measurementBeginTimeMinMilli) { while (interfaceAppManager?.MeasurementInProgress() ?? false) { Thread.Sleep(11); } var processIdLast = interfaceAppManager?.ClientRequest(new ToInterfaceRequest { MemoryMeasurementInitGetLast = true, }) ?.MemoryMeasurementInit?.ProcessId; var MemoryMeasurementInitReuse = processIdLast == processId; var Response = interfaceAppManager?.ClientRequest(new ToInterfaceRequest { MemoryMeasurementInitTake = MemoryMeasurementInitReuse ? null : new MemoryMeasurementInitParam { ProcessId = processId, }, MemoryMeasurementTake = !MemoryMeasurementInitReuse, MemoryMeasurementGetLast = true, }); if (!(measurementBeginTimeMinMilli <= Response?.MemoryMeasurement?.Begin)) { Response = interfaceAppManager?.ClientRequest(new ToInterfaceRequest { MemoryMeasurementTake = true, }); } return(Response); }
static public FromInterfaceResponse ClientRequest( this InterfaceAppManager interfaceAppManager, ToInterfaceRequest request) => FromInterfaceResponse.DeserializeFromString <FromInterfaceResponse>( interfaceAppManager?.ClientRequest(FromInterfaceResponse.SerializeToString(request)));
static public FromInterfaceResponse MeasurementTakeNewRequest( this InterfaceAppManager interfaceAppManager, int processId) => MeasurementTakeRequest(interfaceAppManager, processId, Bib3.Glob.StopwatchZaitMiliSictInt());
static public FromProcessMeasurement <MemoryStruct.IMemoryMeasurement> MeasurementTake( this InterfaceAppManager interfaceAppManager, int processId, Int64 measurementBeginTimeMinMilli) => MeasurementTakeRequest(interfaceAppManager, processId, measurementBeginTimeMinMilli)?.MemoryMeasurement;
static public bool?MeasurementInProgress(this InterfaceAppManager interfaceAppManager) => interfaceAppManager?.ClientRequest(new ToInterfaceRequest())?.MemoryMeasurementInProgress;