Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordotnet-bot <dotnet-bot@microsoft.com>2015-10-01 00:47:24 +0300
committerScott Mosier <smosier@microsoft.com>2015-10-01 00:47:24 +0300
commitad0323ab91a7b1469b42ca5457ddd631b94294fe (patch)
tree88fae57e1ec3aae90288463dc07e58f7aebc1de8 /src/Native/Runtime/GcStressControl.h
parent6763d16387778f126ec510c0421783952602f8f7 (diff)
Initial population of CoreRT Runtime files.
Diffstat (limited to 'src/Native/Runtime/GcStressControl.h')
-rw-r--r--src/Native/Runtime/GcStressControl.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/Native/Runtime/GcStressControl.h b/src/Native/Runtime/GcStressControl.h
new file mode 100644
index 000000000..a24cbc31c
--- /dev/null
+++ b/src/Native/Runtime/GcStressControl.h
@@ -0,0 +1,53 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+#ifndef __GcStressControl_h__
+#define __GcStressControl_h__
+
+
+enum HijackType { htLoop, htCallsite };
+bool ShouldHijackForGcStress(UIntNative CallsiteIP, HijackType ht);
+
+
+enum GcStressThrottleMode {
+ gcstm_TriggerAlways = 0x0000, // trigger a GC every time we hit a GC safe point
+ gcstm_TriggerOnFirstHit = 0x0001, // trigger a GC the first time a GC safe point is hit
+ gcstm_TriggerRandom = 0x0002, // trigger a GC randomly, as defined by GcStressFreqCallsite/GcStressFreqLoop/GcStressSeed
+};
+
+struct CallsiteCountEntry
+{
+ UIntNative callsiteIP;
+ UIntNative countHit;
+ UIntNative countForced;
+ HijackType ht;
+};
+
+typedef DPTR(CallsiteCountEntry) PTR_CallsiteCountEntry;
+
+class CallsiteCountTraits: public NoRemoveSHashTraits< DefaultSHashTraits < CallsiteCountEntry > >
+{
+public:
+ typedef UIntNative key_t;
+
+ static UIntNative GetKey(const CallsiteCountEntry & e) { return e.callsiteIP; }
+
+ static count_t Hash(UIntNative k)
+ { return (count_t) k; }
+
+ static bool Equals(UIntNative k1, UIntNative k2)
+ { return k1 == k2; }
+
+ static CallsiteCountEntry Null()
+ { CallsiteCountEntry e; e.callsiteIP = 0; return e; }
+
+ static bool IsNull(const CallsiteCountEntry & e)
+ { return e.callsiteIP == 0; }
+};
+
+typedef SHash < CallsiteCountTraits > CallsiteCountSHash;
+typedef DPTR(CallsiteCountSHash) PTR_CallsiteCountSHash;
+
+
+#endif // __GcStressControl_h__