Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
ProfilingKey.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 using System.Collections.Generic;
5 
6 namespace SiliconStudio.Core.Diagnostics
7 {
8  /// <summary>
9  /// A key to identify a specific profile.
10  /// </summary>
11  public class ProfilingKey
12  {
13  internal static readonly List<ProfilingKey> AllKeys = new List<ProfilingKey>();
14  internal bool Enabled;
15  internal ProfilingKeyFlags Flags;
16 
17  /// <summary>
18  /// Initializes a new instance of the <see cref="ProfilingKey" /> class.
19  /// </summary>
20  /// <param name="name">The name.</param>
22  {
23  if (name == null) throw new ArgumentNullException("name");
24  Children = new List<ProfilingKey>();
25  Name = name;
26  Flags = flags;
27 
28  lock (AllKeys)
29  {
30  AllKeys.Add(this);
31  }
32  }
33 
34  /// <summary>
35  /// Initializes a new instance of the <see cref="ProfilingKey" /> class.
36  /// </summary>
37  /// <param name="parent">The parent.</param>
38  /// <param name="name">The name.</param>
39  /// <exception cref="System.ArgumentNullException">parent</exception>
41  {
42  if (parent == null) throw new ArgumentNullException("parent");
43  if (name == null) throw new ArgumentNullException("name");
44  Children = new List<ProfilingKey>();
45  Parent = parent;
46 
47  // Register ourself in parent's children.
48  parent.Children.Add(this);
49 
50  Name = string.Format("{0}.{1}", Parent, name);
51  Flags = flags;
52 
53  lock (AllKeys)
54  {
55  AllKeys.Add(this);
56  }
57  }
58 
59  /// <summary>
60  /// Gets the name.
61  /// </summary>
62  /// <value>The name.</value>
63  public string Name { get; private set; }
64 
65  /// <summary>
66  /// Gets the group.
67  /// </summary>
68  /// <value>The group.</value>
69  public ProfilingKey Parent { get; private set; }
70 
71  /// <summary>
72  /// Gets the children.
73  /// </summary>
74  /// <value>
75  /// The children.
76  /// </value>
77  public List<ProfilingKey> Children { get; private set; }
78 
79  public override string ToString()
80  {
81  return Name;
82  }
83  }
84 }
A key to identify a specific profile.
Definition: ProfilingKey.cs:11
_In_ size_t _In_ DXGI_FORMAT _In_ size_t _In_ DXGI_FORMAT _In_ DWORD flags
Definition: DirectXTexP.h:170
ProfilingKey(ProfilingKey parent, string name, ProfilingKeyFlags flags=ProfilingKeyFlags.None)
Initializes a new instance of the ProfilingKey class.
Definition: ProfilingKey.cs:40
Flags
Enumeration of the new Assimp's flags.
ProfilingKey(string name, ProfilingKeyFlags flags=ProfilingKeyFlags.None)
Initializes a new instance of the ProfilingKey class.
Definition: ProfilingKey.cs:21