[mini] Fix test compiling when running !MOBILE
[mono.git] / mcs / class / Mono.Profiler.Log / Mono.Profiler.Log / LogStreamHeader.cs
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.
4
5 using System;
6
7 namespace Mono.Profiler.Log {
8
9         public sealed class LogStreamHeader {
10
11                 const int Id = 0x4d505a01;
12
13                 public Version Version { get; }
14
15                 public int FormatVersion { get; }
16
17                 public byte PointerSize { get; }
18
19                 public ulong StartupTime { get; }
20
21                 public int TimerOverhead { get; }
22
23                 public int Flags { get; }
24
25                 public int ProcessId { get; }
26
27                 public int Port { get; }
28
29                 public string Arguments { get; }
30
31                 public string Architecture { get; }
32
33                 public string OperatingSystem { get; }
34
35                 internal LogStreamHeader (LogReader reader)
36                 {
37                         var id = reader.ReadInt32 ();
38
39                         if (id != Id)
40                                 throw new LogException ($"Invalid stream header ID (0x{id:X}).");
41
42                         Version = new Version (reader.ReadByte (), reader.ReadByte ());
43                         FormatVersion = reader.ReadByte ();
44                         PointerSize = reader.ReadByte ();
45                         StartupTime = reader.ReadUInt64 ();
46                         TimerOverhead = reader.ReadInt32 ();
47                         Flags = reader.ReadInt32 ();
48                         ProcessId = reader.ReadInt32 ();
49                         Port = reader.ReadUInt16 ();
50                         Arguments = reader.ReadHeaderString ();
51                         Architecture = reader.ReadHeaderString ();
52                         OperatingSystem = reader.ReadHeaderString ();
53                 }
54         }
55 }