/// <summary> /// /// </summary> /// <param name="sourceAddress"></param> /// <param name="segmentId"></param> /// <param name="destinationAddress"></param> /// <param name="numBytesToWrite"></param> /// <param name="callback"></param> /// <param name="context"></param> public override void WriteAsync(IntPtr sourceAddress, int segmentId, ulong destinationAddress, uint numBytesToWrite, DeviceIOCompletionCallback callback, object context) { Debug.Assert(destinationAddress + numBytesToWrite <= (ulong)sz_segment, "Out of space in segment - LocalMemoryDevice does not support variable-sized segments needed for the object log"); // We ensure capability of writing to next segment, because there is no // extra buffer space allocated in this device HandleCapacity(segmentId + 1); var q = ioQueue[segmentId % parallelism]; var req = new IORequestLocalMemory { srcAddress = (void *)sourceAddress, dstAddress = ram_segments[segmentId] + destinationAddress, bytes = numBytesToWrite, callback = callback, context = context }; if (latencyTicks > 0) { req.startTime = DateTime.UtcNow.Ticks; } q.Enqueue(req); }
/// <summary> /// /// </summary> /// <param name="segmentId"></param> /// <param name="sourceAddress"></param> /// <param name="destinationAddress"></param> /// <param name="readLength"></param> /// <param name="callback"></param> /// <param name="context"></param> public override void ReadAsync(int segmentId, ulong sourceAddress, IntPtr destinationAddress, uint readLength, DeviceIOCompletionCallback callback, object context) { var q = ioQueue[segmentId % parallelism]; var req = new IORequestLocalMemory { srcAddress = ram_segments[segmentId] + sourceAddress, dstAddress = (void *)destinationAddress, bytes = readLength, callback = callback, context = context }; q.Enqueue(req); }
/// <summary> /// /// </summary> /// <param name="sourceAddress"></param> /// <param name="segmentId"></param> /// <param name="destinationAddress"></param> /// <param name="numBytesToWrite"></param> /// <param name="callback"></param> /// <param name="context"></param> public override void WriteAsync(IntPtr sourceAddress, int segmentId, ulong destinationAddress, uint numBytesToWrite, DeviceIOCompletionCallback callback, object context) { // We ensure capability of writing to next segment, because there is no // extra buffer space allocated in this device HandleCapacity(segmentId + 1); var q = ioQueue[segmentId % parallelism]; var req = new IORequestLocalMemory { srcAddress = (void *)sourceAddress, dstAddress = ram_segments[segmentId] + destinationAddress, bytes = numBytesToWrite, callback = callback, context = context }; q.Enqueue(req); }