1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
7 namespace Mono.Profiler.Log {
9 public sealed class LogStreamHeader {
10 const int MinimumMLPDSupportedVersion = 13;
11 const int MaximumMLPDSupportedVersion = 14;
13 const int Id = 0x4d505a01;
15 public Version Version { get; }
17 public int FormatVersion { get; }
19 public byte PointerSize { get; }
21 public ulong StartupTime { get; }
23 public int TimerOverhead { get; }
25 public int Flags { get; }
27 public int ProcessId { get; }
29 public int Port { get; }
31 public string Arguments { get; }
33 public string Architecture { get; }
35 public string OperatingSystem { get; }
37 internal LogStreamHeader (LogReader reader)
39 var id = reader.ReadInt32 ();
42 throw new LogException ($"Invalid stream header ID (0x{id:X}).");
44 Version = new Version (reader.ReadByte (), reader.ReadByte ());
45 FormatVersion = reader.ReadByte ();
47 if (FormatVersion < MinimumMLPDSupportedVersion || FormatVersion > MaximumMLPDSupportedVersion)
48 throw new LogException ($"Unsupported MLPD version {FormatVersion}. Should be >= {MinimumMLPDSupportedVersion} and <= {MaximumMLPDSupportedVersion}");
50 PointerSize = reader.ReadByte ();
51 StartupTime = reader.ReadUInt64 ();
52 TimerOverhead = reader.ReadInt32 ();
53 Flags = reader.ReadInt32 ();
54 ProcessId = reader.ReadInt32 ();
55 Port = reader.ReadUInt16 ();
56 Arguments = reader.ReadHeaderString ();
57 Architecture = reader.ReadHeaderString ();
58 OperatingSystem = reader.ReadHeaderString ();