public Result <ulong> StartRecordingLoadingTime(LoadingTimeMetadata metadata, TAnnotation annotation) { IntPtr metadataPtr = IntPtr.Zero; uint metadataSize = 0; if (metadata != null) { metadataSize = (uint)Marshal.SizeOf(metadata); metadataPtr = Marshal.AllocHGlobal(Marshal.SizeOf(metadata)); Marshal.StructureToPtr(metadata, metadataPtr, false); } var ps = CProtobufSerialization.Create(annotation); ulong handle = 0; var errorCode = m_LibraryMethods.StartRecordingLoadingTime( metadataPtr, metadataSize, ref ps, ref handle); CProtobufSerialization.CallDealloc(ref ps); if (metadataPtr != IntPtr.Zero) { Marshal.FreeHGlobal(metadataPtr); } return(new Result <ulong>(errorCode, handle)); }
public static LoadingTimeMetadata Copy(LoadingTimeMetadata toBeCopied) { LoadingTimeMetadata newMetadata = new LoadingTimeMetadata() { state = toBeCopied.state, source = toBeCopied.source, compression_level = toBeCopied.compression_level, network_connectivity = toBeCopied.network_connectivity, network_transfer_speed_bps = toBeCopied.network_transfer_speed_bps, network_latency_ns = toBeCopied.network_latency_ns }; return(newMetadata); }
/// <summary> /// Start a loading group. Subsequent loading times will be tagged /// with this group's id until <see cref="StartLoadingGroup"/> is called again or /// <see cref="StopLoadingGroup"/> is called. Note that if you do not intend to call /// <see cref="StopLoadingGroup"/> , you should set the metadata and annotation to null. /// </summary> /// <param name="eventMetadata">A <see cref="LoadingTimeMetadata"/> structure.</param> /// <param name="annotation"> The annotation to use with this event.</param> /// <returns> /// Result and a handle for this event (currently is always null since there /// can only be one loading group active). /// </returns> public Result <ulong> StartLoadingGroup(LoadingTimeMetadata eventMetadata, TAnnotation annotation) { return(m_AdditionalLibraryMethods.StartLoadingGroup(eventMetadata, annotation)); }