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 {
11 const int MinVersion = 13;
12 const int MaxVersion = 14;
14 const int Id = 0x4d505a01;
16 public Version Version { get; }
18 public int FormatVersion { get; }
20 public byte PointerSize { get; }
22 public ulong StartupTime { get; }
24 public int TimerOverhead { get; }
26 public int Flags { get; }
28 public int ProcessId { get; }
30 public int Port { get; }
32 public string Arguments { get; }
34 public string Architecture { get; }
36 public string OperatingSystem { get; }
38 internal LogStreamHeader (LogReader reader)
40 var id = reader.ReadInt32 ();
43 throw new LogException ($"Invalid stream header ID (0x{id:X}).");
45 Version = new Version (reader.ReadByte (), reader.ReadByte ());
46 FormatVersion = reader.ReadByte ();
48 if (FormatVersion < MinVersion || FormatVersion > MaxVersion)
49 throw new LogException ($"Unsupported MLPD version {FormatVersion}. Should be >= {MinVersion} and <= {MaxVersion}.");
51 PointerSize = reader.ReadByte ();
52 StartupTime = reader.ReadUInt64 ();
53 TimerOverhead = reader.ReadInt32 ();
54 Flags = reader.ReadInt32 ();
55 ProcessId = reader.ReadInt32 ();
56 Port = reader.ReadUInt16 ();
57 Arguments = reader.ReadHeaderString ();
58 Architecture = reader.ReadHeaderString ();
59 OperatingSystem = reader.ReadHeaderString ();