public void TestUsage() { MemoryUsage usage1 = new MemoryUsage(2048); Assert.That(!usage1.IsFull()); Assert.That(usage1.Usage == 0); usage1.IncreaseUsage(1024); Assert.That(!usage1.IsFull()); Assert.That(usage1.Usage == 1024); usage1.DecreaseUsage(512); Assert.That(!usage1.IsFull()); Assert.That(usage1.Usage == 512); usage1.Usage = 2048; Assert.That(usage1.IsFull()); Assert.That(usage1.Usage == 2048); usage1.IncreaseUsage(1024); Assert.That(usage1.IsFull()); Assert.That(usage1.Usage == 3072); }
public MessageProducer(Session session, ProducerId id, ActiveMQDestination destination, TimeSpan requestTimeout) { this.session = session; this.RequestTimeout = requestTimeout; this.info = new ProducerInfo(); this.info.ProducerId = id; this.info.Destination = destination; this.info.WindowSize = session.Connection.ProducerWindowSize; this.messageTransformation = session.Connection.MessageTransformation; // If the destination contained a URI query, then use it to set public // properties on the ProducerInfo if (destination != null && destination.Options != null) { URISupport.SetProperties(this.info, destination.Options, "producer."); } // Version Three and higher will send us a ProducerAck, but only if we // have a set producer window size. if (session.Connection.ProtocolVersion >= 3 && this.info.WindowSize > 0) { if (Tracer.IsDebugEnabled) { Tracer.Debug("MessageProducer created with a Window Size of: " + this.info.WindowSize); } this.usage = new MemoryUsage(this.info.WindowSize); } }
public void WaitForIndexesToBecomeNonStale() { MemoryUsage.Clear(); while (true) { process.Refresh(); MemoryUsage.Add(process.WorkingSet64); var statistics = store.DatabaseCommands.GetStatistics(); if (statistics.StaleIndexes.Length == 0 && doneImporting) { return; } foreach (var staleIndex in statistics.StaleIndexes) { var indexStats = statistics.Indexes.Single(x => x.Name == staleIndex); var latencyInTime = (DateTime.UtcNow - indexStats.LastIndexedTimestamp).TotalMilliseconds; LatencyTimes.Add(new KeyValuePair <string, double>(staleIndex, latencyInTime)); var latencyInDocuments = statistics.CountOfDocuments - indexStats.IndexingAttempts; LatencyInDocuments.Add(new KeyValuePair <string, long>(staleIndex, latencyInDocuments)); logger.Debug("Stale index {0} - {1:#,#}/{2:#,#} - latency: {3:#,#}, {4:#,#}ms", indexStats.Id, indexStats.IndexingAttempts, statistics.CountOfDocuments, latencyInDocuments, latencyInTime); } Thread.Sleep(1000); } }
public void AddData() { MemoryUsage.Clear(); doneImporting = false; var session = store.OpenSession(); var count = 0; logger.Info("Testing RavenDB Log"); var sp = ParseDisks(diskToAdd => { session.Store(diskToAdd); count += 1; if (count < BatchSize) { return; } session.SaveChanges(); session = store.OpenSession(); count = 0; }); session.SaveChanges(); logger.Info(" "); logger.Info("Done in {0}", sp.Elapsed); doneImporting = true; }
public virtual void TestSimpleByteArrays() { MemoryMXBean memoryMXBean = ManagementFactory.MemoryMXBean; object[][] all = new object[0][]; try { while (true) { // Check the current memory consumption and provide the estimate. CauseGc(); MemoryUsage mu = memoryMXBean.HeapMemoryUsage; long estimated = ShallowSizeOf(all); if (estimated > 50 * RamUsageEstimator.ONE_MB) { break; } Console.WriteLine(string.format(Locale.ROOT, "%10s\t%10s\t%10s", RamUsageEstimator.humanReadableUnits(mu.Used), RamUsageEstimator.humanReadableUnits(mu.Max), RamUsageEstimator.humanReadableUnits(estimated))); // Make another batch of objects. object[] seg = new object[10000]; all = Arrays.copyOf(all, all.Length + 1); all[all.Length - 1] = seg; for (int i = 0; i < seg.Length; i++) { seg[i] = new sbyte[Random().Next(7)]; } } } catch (System.OutOfMemoryException e) { // Release and quit. } }
public void Setup() { _statsd = new Mock <IVeStatsDClient>(); _statsd.Setup(x => x.LogGauge(It.IsAny <string>(), It.IsAny <int>(), It.IsAny <Dictionary <string, string> >())); _metric = new MemoryUsage(); _metric.Execute(_statsd.Object); }
public void Unpublish() { CpuUsage.Unpublish(); CpuCapacity.Unpublish(); MemoryUsage.Unpublish(); TotalNetworkBytesIn.Unpublish(); TotalNetworkBytesOut.Unpublish(); TotalDiskBytesRead.Unpublish(); TotalDiskBytesWrite.Unpublish(); }
public void Dispose() { CpuUsage.Remove(); CpuCapacity.Remove(); MemoryUsage.Remove(); TotalNetworkBytesIn.Remove(); TotalNetworkBytesOut.Remove(); TotalDiskBytesRead.Remove(); TotalDiskBytesWrite.Remove(); }
private Stopwatch ParseDisks(Action <Disk> addToBatch) { int i = 0; var parser = new Parser(); var buffer = new byte[1024 * 1024]; // more than big enough for all files var sp = Stopwatch.StartNew(); using (var bz2 = new BZip2InputStream(File.Open(dataLocation, FileMode.Open))) using (var tar = new TarInputStream(bz2)) { TarEntry entry; while ((entry = tar.GetNextEntry()) != null) { if (entry.Size == 0 || entry.Name == "README" || entry.Name == "COPYING") { continue; } var readSoFar = 0; while (true) { var read = tar.Read(buffer, readSoFar, ((int)entry.Size) - readSoFar); if (read == 0) { break; } readSoFar += read; } // we do it in this fashion to have the stream reader detect the BOM / unicode / other stuff // so we can read the values properly var fileText = new StreamReader(new MemoryStream(buffer, 0, readSoFar)).ReadToEnd(); try { var disk = parser.Parse(fileText); addToBatch(disk); if (i++ % BatchSize == 0) { process.Refresh(); MemoryUsage.Add(process.WorkingSet64); logger.Info("\r{0} {1:#,#} {2} ", entry.Name, i, sp.Elapsed); } } catch (Exception e) { logger.Error(""); logger.Error(entry.Name); logger.Error(e); return(sp); } } } return(sp); }
internal async Task DoSendAsync(ActiveMQDestination destination, ActiveMQMessage message, MessageProducer producer, MemoryUsage producerWindow, TimeSpan sendTimeout) { ActiveMQMessage msg = message; if (destination.IsTemporary && !connection.IsTempDestinationActive(destination as ActiveMQTempDestination)) { throw new InvalidDestinationException("Cannot publish to a deleted Destination: " + destination); } if (IsTransacted) { DoStartTransaction(); msg.TransactionId = TransactionContext.TransactionId; } msg.RedeliveryCounter = 0; msg.BrokerPath = null; if (this.connection.CopyMessageOnSend) { msg = (ActiveMQMessage)msg.Clone(); } msg.OnSend(); msg.ProducerId = msg.MessageId.ProducerId; if (sendTimeout.TotalMilliseconds <= 0 && !msg.ResponseRequired && !connection.AlwaysSyncSend && (!msg.Persistent || connection.AsyncSend || msg.TransactionId != null)) { this.connection.Oneway(msg); if (producerWindow != null) { // Since we defer lots of the marshaling till we hit the wire, this // might not provide and accurate size. We may change over to doing // more aggressive marshaling, to get more accurate sizes.. this is more // important once users start using producer window flow control. producerWindow.IncreaseUsage(msg.Size()); } } else { if (sendTimeout.TotalMilliseconds > 0) { await this.connection.SyncRequestAsync(msg, sendTimeout).Await(); } else { await this.connection.SyncRequestAsync(msg).Await(); } } }
public void TestConstructors() { MemoryUsage usage = new MemoryUsage(); Assert.That(usage.Limit == 0); Assert.That(usage.Usage == 0); usage = new MemoryUsage(1024); Assert.That(usage.Limit == 1024); Assert.That(usage.Usage == 0); }
public MessageProducer(Session session, ProducerInfo info) { this.session = session; this.info = info; this.RequestTimeout = session.RequestTimeout; // Version Three and higher will send us a ProducerAck, but only if we // have a set producer window size. if (session.Connection.ProtocolVersion >= 3 && info.WindowSize > 0) { usage = new MemoryUsage(info.WindowSize); } }
private void DoMemoryUpdates() { MemoryMXBean memoryMXBean = ManagementFactory.GetMemoryMXBean(); MemoryUsage memNonHeap = memoryMXBean.GetNonHeapMemoryUsage(); MemoryUsage memHeap = memoryMXBean.GetHeapMemoryUsage(); Runtime runtime = Runtime.GetRuntime(); metrics.SetMetric("memNonHeapUsedM", memNonHeap.GetUsed() / M); metrics.SetMetric("memNonHeapCommittedM", memNonHeap.GetCommitted() / M); metrics.SetMetric("memHeapUsedM", memHeap.GetUsed() / M); metrics.SetMetric("memHeapCommittedM", memHeap.GetCommitted() / M); metrics.SetMetric("maxMemoryM", runtime.MaxMemory() / M); }
/// <summary> /// Save resource usage to database /// </summary> public void SaveUsage() { CpuUsage cpuUsage = new CpuUsage(); MemoryUsage memoryAvailable = new MemoryUsage(); while (true) { float cpuUsageValue = cpuUsage.Current(); float memoryUsageValue = memoryAvailable.Current(); Console.WriteLine(Convert.ToString(cpuUsageValue) + "% || " + Convert.ToString(memoryUsageValue) + " MB"); this.dbHandler.SaveResourceUsage(new TotalResourceUsageModel(this.SecondsSinceEpoh(), cpuUsageValue, memoryUsageValue)); } }
private void GetMemoryUsage(MetricsRecordBuilder rb) { MemoryUsage memNonHeap = memoryMXBean.GetNonHeapMemoryUsage(); MemoryUsage memHeap = memoryMXBean.GetHeapMemoryUsage(); Runtime runtime = Runtime.GetRuntime(); rb.AddGauge(JvmMetricsInfo.MemNonHeapUsedM, memNonHeap.GetUsed() / M).AddGauge(JvmMetricsInfo .MemNonHeapCommittedM, memNonHeap.GetCommitted() / M).AddGauge(JvmMetricsInfo.MemNonHeapMaxM , memNonHeap.GetMax() / M).AddGauge(JvmMetricsInfo.MemHeapUsedM, memHeap.GetUsed () / M).AddGauge(JvmMetricsInfo.MemHeapCommittedM, memHeap.GetCommitted() / M).AddGauge (JvmMetricsInfo.MemHeapMaxM, memHeap.GetMax() / M).AddGauge(JvmMetricsInfo.MemMaxM , runtime.MaxMemory() / M); }
public void TestTimedWait() { MemoryUsage usage = new MemoryUsage(2048); usage.IncreaseUsage(5072); DateTime start = DateTime.Now; usage.WaitForSpace(TimeSpan.FromMilliseconds(150)); DateTime end = DateTime.Now; TimeSpan timePassed = end - start; Assert.That(timePassed.TotalMilliseconds >= 125); }
public IDisposable MeasureEventMemoryUsage(string componentName, string eventName) { if (!StateSynchronizationPerformanceParameters.EnablePerformanceReporting) { return(null); } var key = new PerformanceEventKey(componentName, eventName); if (!eventMemoryUsage.TryGetValue(key, out var memoryUsage)) { memoryUsage = new MemoryUsage(); eventMemoryUsage.Add(key, memoryUsage); } return(new MemoryScope(memoryUsage)); }
public AllocationCreateInfo(AllocationCreateFlags flags = default, AllocationStrategyFlags strategy = default, MemoryUsage usage = default, MemoryPropertyFlags requiredFlags = default, MemoryPropertyFlags preferredFlags = default, uint memoryTypeBits = 0, VulkanMemoryPool?pool = null, object?userData = null) { Flags = flags; Strategy = strategy; Usage = usage; RequiredFlags = requiredFlags; PreferredFlags = preferredFlags; MemoryTypeBits = memoryTypeBits; Pool = pool; UserData = userData; }
public void TestWait() { MemoryUsage usage = new MemoryUsage(2048); usage.IncreaseUsage(5072); Thread thread1 = new Thread(delegate() { Thread.Sleep(100); usage.DecreaseUsage(usage.Usage); }); thread1.Start(); usage.WaitForSpace(); Assert.That(usage.Usage == 0); thread1.Join(); }
void LookLikeTheOldStructure() { // We used to just put a Dictionary<string, string> in there, but for better OO principles I changed it to an // object. Unfortunately, I broke it when I did that so it stored an array of the objects and it didn't deserialize // properly any more. Let's make sure when a Data object with the new object is used that it matches the old format. string old_format = "{\"Value\":{\"Memory Capacity\":\"17098178560\",\"Free Memory\":\"15014670336\",\"Memory Used\":\"2083508224\"}}"; DataCollectorContext context = new DataCollectorContext(new CollectorID(-1, "Memory"), ECollectorType.Memory); MemoryUsage usage = new MemoryUsage() { CapacityNum = 17098178560, FreeNum = 15014670336 }; Data d = new GenericData <MemoryUsage>(context, usage); string new_format = JsonConvert.SerializeObject(d, Newtonsoft.Json.Formatting.None, new Newtonsoft.Json.JsonSerializerSettings { StringEscapeHandling = StringEscapeHandling.EscapeHtml }); Assert.Equal(old_format, new_format); }
public MemoryScope(MemoryUsage memoryUsage) { calculationCompleted = false; if (!Profiler.enabled) { UnityEngine.Debug.LogError($"Profiler not enabled, MemoryUsage not supported."); this.memoryUsage = null; startingAllocatedMemory = 0; startingReservedMemory = 0; startingUnusedMemory = 0; } else { this.memoryUsage = memoryUsage; startingAllocatedMemory = Profiler.GetTotalAllocatedMemoryLong(); startingReservedMemory = Profiler.GetTotalReservedMemoryLong(); startingUnusedMemory = Profiler.GetTotalUnusedReservedMemoryLong(); } }
/// <summary> /// Result from the free command /// </summary> public static MemoryUsage ServerMemoryUsage() { try { using (Process proc = new Process() { StartInfo = new ProcessStartInfo { FileName = "free", UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true } }) { proc.Start(); proc.WaitForExit(); //Skip labels proc.StandardOutput.ReadLine(); string l = proc.StandardOutput.ReadLine(); string lc = proc.StandardOutput.ReadLine(); string[] values = l.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); string[] valuesc = lc.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); MemoryUsage mu = new MemoryUsage(); if (values.Length >= 3) { //Megs mu.Total = double.Parse(values [1]) * 1024; mu.Used = double.Parse(valuesc [2]) * 1024; #if DEBUG //mu.Used = 0.99 * mu.Total; #endif } return(mu); } } catch (Exception) { return(null); } }
/// <summary> /// Result from the free command /// </summary> public static MemoryUsage ServerMemoryUsage() { try { using (Process proc = new Process() { StartInfo = new ProcessStartInfo { FileName = "free", UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true } }) { proc.Start(); proc.WaitForExit(); //Skip labels proc.StandardOutput.ReadLine(); string l = proc.StandardOutput.ReadLine(); string lc = proc.StandardOutput.ReadLine(); string[] values = l.Split(new char[]{' '}, StringSplitOptions.RemoveEmptyEntries); string[] valuesc = lc.Split(new char[]{' '}, StringSplitOptions.RemoveEmptyEntries); MemoryUsage mu = new MemoryUsage(); if (values.Length >= 3) { //Megs mu.Total = double.Parse(values [1]) * 1024; mu.Used = double.Parse(valuesc [2]) * 1024; #if DEBUG //mu.Used = 0.99 * mu.Total; #endif } return mu; } } catch (Exception) { return null; } }
/// <summary> /// Initialize the event data. /// </summary> /// <param name="currentMemoryUsage"></param> public void Initialize(MemoryUsage currentMemoryUsage) { BaseInitialize(); CurrentMemoryUsage = currentMemoryUsage; }
private void drawMemoryGraph() { Graphics g = Graphics.FromImage(memoryGraph); int fw = memoryGraph.Width; int fh = memoryGraph.Height; ulong totalMemory = (ulong)memStats.TotalVisibleMemorySize * 1024; double rate; MemoryUsage latestUsage = memStats.Latest; if (latestUsage.Used + latestUsage.Available > totalMemory * 1.5) { rate = (double)fh / (totalMemory * 3.0);// (double)memStats.CommitLimit; } else { rate = (double)fh / (totalMemory * 1.5); } int border = (int)(totalMemory * rate); g.FillRectangle(new SolidBrush(Color.White), 0, 0, fw, fh); Pen pen = new Pen(Color.FromArgb(220, 220, 220), 1F); for (int y = fh; y > 0; y -= (int)(256 * 1024 * 1024 * rate)) { g.DrawLine(pen, 0, y, fw, y); } g.SmoothingMode = SmoothingMode.None; Brush availableBrush = new SolidBrush(Color.FromArgb(180, 100, 100, 255)); Brush kernelBrush = new SolidBrush(Color.FromArgb(180, 255, 0, 0)); Brush commitedBrush = new SolidBrush(Color.FromArgb(180, 255, 145, 0)); Brush systemCacheBrush = new SolidBrush(Color.FromArgb(50, 255, 0, 0)); // Brush spaceBrush = new SolidBrush(Color.FromArgb(180, 240, 230, 255)); Brush spaceBrush = new SolidBrush(Color.FromArgb(100, 100, 100, 255)); int count = memStats.Count; int bw = (fw + (60 - 1)) / 60; for (int i = 0; i < count; i++) { MemoryUsage usage = memStats[i]; int x = fw - i * bw - bw; int y = fh; int w = bw; int h = 0; h = (int)((usage.KernelTotal) * rate); y -= h; g.FillRectangle(kernelBrush, x, y, w, h); h = (int)(usage.SystemCache * rate); y -= h; g.FillRectangle(systemCacheBrush, x, y, w, h); h = (int)((usage.Committed - usage.KernelTotal) * rate); y -= h; g.FillRectangle(commitedBrush, x, y, w, h); h = (int)(usage.Available * rate); y -= h; g.FillRectangle(availableBrush, x, y, w, h); h = y; y = 0; g.FillRectangle(spaceBrush, x, y, w, h); x = fw - i * bw - bw; w = bw / 2; h = (int)(usage.Pagein); y = fh - h; g.FillRectangle(Brushes.LightGray, x, y, w, h); x = fw + bw / 2 - i * bw - bw; w = bw / 2; h = (int)(usage.Pageout); y = fh - h; g.FillRectangle(Brushes.Black, x, y, w, h); } Pen borderPen = new Pen(Color.Blue); borderPen.DashStyle = DashStyle.Dash; g.DrawLine(borderPen, 0, fh - border, fw, fh - border); g.Dispose(); if (memStats.Count > 0) { MemoryUsage u = memStats[0]; lblTotal.Text = (memStats.TotalVisibleMemorySize / (1024.0)).ToString("#####0.0MB"); lblFree.Text = (u.Available / (1048576.0)).ToString("#####0.0MB"); lblCommited.Text = (u.Committed / (1048576.0)).ToString("#####0.0MB"); lblSysCache.Text = (u.SystemCache / (1048576.0)).ToString("#####0.0MB"); lblSystem.Text = (u.KernelTotal / (1048576.0)).ToString("#####0.0MB"); } }
public void CountProcessorUsage(object sender, EventArgs e) { cpuStats.Update(); CPUUsage cpuUsage = cpuStats.Latest; memStats.Update(); MemoryUsage memUsage = memStats.Latest; pageio_count += memUsage.Pageout * (memUsage.Pagein + 1); //if (pageio_count > 0) pageio_count += memUsage.Pagein; pageio_count -= pageio_count / 50 + 1; if (pageio_count < 0) { pageio_count = 0; } int pattern = cpuUsage.Active / 10; pattern += memUsage.Pageout / 15; pattern += memUsage.Pagein / 30; if (pattern > 10) { pattern = 10; } FaceDef.PatternSuite suite = FaceDef.PatternSuite.Normal; UInt64 avilable = (UInt64)memStats.TotalVisibleMemorySize * 1024 - memUsage.Used; if (pageio_count > 100) { suite = FaceDef.PatternSuite.MemoryInsufficient; } else if (avilable < 0) { suite = FaceDef.PatternSuite.MemoryDecline; } int markers = FaceDef.MarkerNone; if (memUsage.Pagein > 0) { markers += FaceDef.MarkerPageIn; } if (memUsage.Pageout > 0) { markers += FaceDef.MarkerPageOut; } if (patternWindow != null) { patternWindow.UpdatePattern(suite, pattern, markers); } if (statusWindow != null) { statusWindow.UpdateGraph(); } if (optimusMini.IsAlive && curFaceDef != null) { Bitmap image = new Bitmap(96, 96); Graphics g = Graphics.FromImage(image); g.FillRectangle(new SolidBrush(Color.White), 0, 0, image.Width, image.Height); curFaceDef.DrawPatternImage(g, suite, pattern, markers, 96F / 128F); g.Dispose(); optimusMini.ShowPicture(1, image); } }
public MemoryNotificationInfo(String arg0, MemoryUsage arg1, long arg2) : base(ProxyCtor.I) { Instance.CallConstructor("(Ljava/lang/String;Ljava/lang/management/MemoryUsage;J)V", arg0, arg1, arg2); }
public MemoryUsageTest() { _memoryUsage = new MemoryUsage(_timerFactory); }
public override int GetHashCode() { int hash = 1; if (Name.Length != 0) { hash ^= Name.GetHashCode(); } if (Id.Length != 0) { hash ^= Id.GetHashCode(); } if (AppEngineRelease.Length != 0) { hash ^= AppEngineRelease.GetHashCode(); } if (Availability != global::Google.Cloud.AppEngine.V1.Instance.Types.Availability.Unspecified) { hash ^= Availability.GetHashCode(); } if (VmName.Length != 0) { hash ^= VmName.GetHashCode(); } if (VmZoneName.Length != 0) { hash ^= VmZoneName.GetHashCode(); } if (VmId.Length != 0) { hash ^= VmId.GetHashCode(); } if (startTime_ != null) { hash ^= StartTime.GetHashCode(); } if (Requests != 0) { hash ^= Requests.GetHashCode(); } if (Errors != 0) { hash ^= Errors.GetHashCode(); } if (Qps != 0F) { hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Qps); } if (AverageLatency != 0) { hash ^= AverageLatency.GetHashCode(); } if (MemoryUsage != 0L) { hash ^= MemoryUsage.GetHashCode(); } if (VmStatus.Length != 0) { hash ^= VmStatus.GetHashCode(); } if (VmDebugEnabled != false) { hash ^= VmDebugEnabled.GetHashCode(); } if (VmIp.Length != 0) { hash ^= VmIp.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public static void ReadMessage(BinaryReader reader, out ParsedMessage message) { bool performanceMonitoringEnabled = reader.ReadBoolean(); List <Tuple <string, double> > durations = null; List <Tuple <string, double> > summedDurations = null; List <Tuple <string, int> > counts = null; List <Tuple <string, MemoryUsage> > memoryUsages = null; if (!performanceMonitoringEnabled) { message = ParsedMessage.Empty; return; } int durationsCount = reader.ReadInt32(); if (durationsCount > 0) { durations = new List <Tuple <string, double> >(); for (int i = 0; i < durationsCount; i++) { string eventName = reader.ReadString(); double eventDuration = reader.ReadDouble(); durations.Add(new Tuple <string, double>(eventName, eventDuration)); } } int summedDurationsCount = reader.ReadInt32(); if (summedDurationsCount > 0) { summedDurations = new List <Tuple <string, double> >(); for (int i = 0; i < summedDurationsCount; i++) { string eventName = reader.ReadString(); double eventDuration = reader.ReadDouble(); summedDurations.Add(new Tuple <string, double>(eventName, eventDuration)); } } int countsCount = reader.ReadInt32(); if (countsCount > 0) { counts = new List <Tuple <string, int> >(); for (int i = 0; i < countsCount; i++) { string eventName = reader.ReadString(); int eventCount = reader.ReadInt32(); counts.Add(new Tuple <string, int>(eventName, eventCount)); } } int memoryUsageCount = reader.ReadInt32(); if (memoryUsageCount > 0) { memoryUsages = new List <Tuple <string, MemoryUsage> >(); for (int i = 0; i < memoryUsageCount; i++) { string eventName = reader.ReadString(); MemoryUsage usage = new MemoryUsage(); usage.TotalAllocatedMemory = reader.ReadInt64(); usage.TotalReservedMemory = reader.ReadInt64(); usage.TotalUnusedReservedMemory = reader.ReadInt64(); memoryUsages.Add(new Tuple <string, MemoryUsage>(eventName, usage)); } } message = new ParsedMessage(performanceMonitoringEnabled, durations, summedDurations, counts, memoryUsages); }