Skip to content

Commit

Permalink
Added method monitoring for finding slow methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillermo Janner Acero committed Sep 20, 2018
1 parent 1ae64ab commit 06f0ec2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sprung/FodyWeavers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<Weavers>
<MethodTimer/>
</Weavers>
22 changes: 22 additions & 0 deletions Sprung/MethodTimerLogger.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace Sprung
{
public static class MethodTimeLogger
{
public static void Log(MethodBase methodBase, long milliseconds, string message)
{
using (StreamWriter w = File.AppendText("log.txt"))
{
w.WriteLine($"{methodBase.Name} {milliseconds}");
}
}
}
}

0 comments on commit 06f0ec2

Please sign in to comment.