Skip to content

Instantly share code, notes, and snippets.

View naveensrinivasan's full-sized avatar

Naveen naveensrinivasan

View GitHub Profile
@naveensrinivasan
naveensrinivasan / MeasureWithGCInformation.linq
Last active August 29, 2015 14:20
MeasureIt With GC Information
<Query Kind="Program">
<NuGetReference>MeasureIt.exe</NuGetReference>
<NuGetReference>Microsoft.Diagnostics.Tracing.TraceEvent</NuGetReference>a
<NuGetReference>Rx-Core</NuGetReference>
<NuGetReference>Rx-Interfaces</NuGetReference>
<NuGetReference>Rx-Linq</NuGetReference>
<NuGetReference>Rx-Main</NuGetReference>
<Namespace>Microsoft.Diagnostics.Tracing</Namespace>
<Namespace>Microsoft.Diagnostics.Tracing.Parsers</Namespace>
<Namespace>Microsoft.Diagnostics.Tracing.Parsers.Clr</Namespace>
@naveensrinivasan
naveensrinivasan / TraceVisualStudioStartUp
Last active August 29, 2015 14:21
ETW Trace visualstudio
perfview -Providers:CodeMarkers -ThreadTime -NoV2Rundown -DataFile:devenv-startup.etl
-Merge:false -Zip:false run "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe"
@naveensrinivasan
naveensrinivasan / DynamicETW.cs
Created May 29, 2015 03:16
Log dynamic Custom objects in ETW using EventSource
using System;
using System.Collections.Generic;
using Microsoft.Diagnostics.Tracing;
namespace ETWSamples
{
/// <summary>
/// How to generate dynamic etw events without inheriting and eventsource class.
/// This is not advisable.
/// </summary>
@naveensrinivasan
naveensrinivasan / TraceDynamicETW
Created May 29, 2015 03:24
Trace Dynamic ETW events using Perfview only for the specific provider
PerfView /onlyProviders=*Dynamic collect
@naveensrinivasan
naveensrinivasan / StartStopEvent.cs
Created June 8, 2015 19:33
Use custom event to get start and stop duration
using Microsoft.Diagnostics.Tracing;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace ETWSamples
{
@naveensrinivasan
naveensrinivasan / YogaGloStats.cs
Created June 17, 2015 18:17
Download yogaglo stats
// Change the cookie information to your cookie which can be got from fiddler or any http proxy
var wc = new WebClient();
wc.Headers.Add("X_AUTHENTICATION_TOKEN","LBi9REOX6hwCM2HWPfqDGM9EI6KWnoR1GxXFYSu9hmo=");
wc.Headers.Add("Accept","application/json");
wc.Headers.Add("Cookie","sec cookie");
var result = await wc.DownloadStringTaskAsync("https://www.yogaglo.com/api/v4/histories?limit=50");
public class Teacher
{
[JsonProperty("first_name")]
public string first_name { get; set; }
[JsonProperty("last_name")]
public string last_name { get; set; }
}
public class Prop
{
@naveensrinivasan
naveensrinivasan / Yogaglowduration.cs
Created June 17, 2015 18:35
Duration I have done yoga grouped by date.
var items = JsonConvert.DeserializeObject<PraticeHistory>(result);
items.history.Select (h => new { WatchedDate =epoch.AddSeconds( h.date_watched_timestamp).ToLocalTime(),
h.video.category, Duration = Convert.ToInt32( h.video.durationMin), h.video.level, h.video.short_description,
h.video.style, h.video.title })
.GroupBy (h => h.WatchedDate.ToShortDateString())
.Select (h => new {h.Key, Duration = h.Select (x => x.Duration)})
.Aggregate ((x,y) => x+y)} )
.Dump();
Perfview commandLine
"/DataFile:PerfViewData.etl" /CircularMB:500 /MinSecForTrigger:0 /ClrEvents:GC,Binder,Loader,Jit,StopEnumeration,Security,AppDomainResourceManagement,Contention,Exception,Threading,JittedMethodILToNativeMap,OverrideAndSuppressNGenEvents,Type,GCHeapSurvivalAndMovement,GCHeapAndTypeNames,Stack,ThreadTransfer /Providers:"Microsoft-Windows-IIS" /NoNGenRundown "
aff081fe-0247-4275-9c4e-021f3dc1da35
ee799f41-cfa5-550b-bf2c-344747c1c668
de4649c9-15e8-4fea-9d85-1cdda520c334
de4649c9-15e8-4fea-9d85-1cdda520c334
aff081fe-0247-4275-9c4e-021f3dc1da35
06b94d9a-b15e-456e-a4ef-37c984a2cb4b
d55d3bc9-cba9-44df-827e-132d3a4596c2
a1c2040e-8840-4c31-ba11-9871031a19ea
3a2a4e84-4c21-4981-ae10-3fda0d9b0f83
23108b68-1b7e-43fa-94fb-ec3066805744