Skip to content

Instantly share code, notes, and snippets.

View Criteo-dotnet-blog's full-sized avatar

Criteo-dotnet-blog

View GitHub Profile
public IEnumerable<ThreadPoolItem> EnumerateLocalThreadPoolItems()
{
    var queueType = GetMscorlib().GetTypeByName("System.Threading.ThreadPoolWorkQueue");
    if (queueType == null)
        yield break;
    ClrStaticField threadQueuesField = queueType.GetStaticFieldByName("allThreadQueues");
    if (threadQueuesField == null)
        yield break;
private IEnumerable<ThreadPoolItem> EnumerateThreadPoolWorkQueue(ulong workQueueRef)
{
    // start from the tail and follow the Next
    var proxy = _heap.GetProxy(workQueueRef);
    var currentQueueSegment = proxy.queueTail;
    while (currentQueueSegment != null)
    {
        // get the System.Threading.ThreadPoolWorkQueue+QueueSegment nodes array
        var nodes = currentQueueSegment.nodes;
        object workQueueValue = workQueueField.GetValue(appDomain);
        ulong workQueueRef = (workQueueValue == null) ? 0L : (ulong)workQueueValue;
        if (workQueueRef == 0)
            continue;
        // should be System.Threading.ThreadPoolWorkQueue
        ClrType workQueueType = _heap.GetObjectType(workQueueRef);
        if (workQueueType == null)
            continue;
        if (workQueueType.Name != "System.Threading.ThreadPoolWorkQueue")
public IEnumerable<ThreadPoolItem> EnumerateGlobalThreadPoolItems()
{
    // look for the ThreadPoolGlobals.workQueue static field
    ClrModule mscorlib = GetMscorlib();
    if (mscorlib == null)
        throw new InvalidOperationException("Impossible to find mscorlib.dll");
    ClrType queueType = mscorlib.GetTypeByName("System.Threading.ThreadPoolGlobals");
    if (queueType == null)
        yield break;
@inproceedings{DiemertMeynet2017,
author = {{Diemert Eustache, Meynet Julien} and Galland, Pierre and Lefortier, Damien},
title={Attribution Modeling Increases Efficiency of Bidding in Display Advertising},
publisher = {ACM},
pages={To appear},
booktitle = {Proceedings of the AdKDD and TargetAd Workshop, KDD, Halifax, NS, Canada, August, 14, 2017},
year = {2017}
}
public partial class DebuggerExtensions
{
    [DllExport("Help")]
    public static void Help(IntPtr client, [MarshalAs(UnmanagedType.LPStr)] string args)
    {
        OnHelp(client, args);
    }
   [DllExport("help")]
   public static void help(IntPtr client, [MarshalAs(UnmanagedType.LPStr)] string args)
[DllExport("tks")]
public static void tks(IntPtr client, [MarshalAs(UnmanagedType.LPStr)] string args)
{
    OnTkState(client, args);
}
[DllExport("tkstate")]
public static void tkstate(IntPtr client, [MarshalAs(UnmanagedType.LPStr)] string args)
{
    OnTkState (client, args);
public partial class DebuggerExtensions
{
    public static IDebugClient DebugClient { get; private set; }
    public static DataTarget DataTarget { get; private set; }
    public static ClrRuntime Runtime { get; private set; }
// Must be the first thing in our extension.
if (!InitApi(client))
    return;
public static void MyCommand(IntPtr client, [MarshalAs(UnmanagedType.LPStr)] string args)