-
Recent Posts
Recent Comments
Mark ter Luun on Cast WIA.Imagefile to System.D…Archives
- June 2019
- October 2015
- April 2015
- March 2015
- November 2014
- September 2014
- June 2014
- May 2014
- March 2014
- February 2014
- November 2013
- August 2013
- July 2013
- June 2013
- May 2013
- September 2012
- August 2012
- July 2012
- June 2012
- April 2012
- December 2011
- October 2011
- September 2011
- August 2011
- July 2011
- June 2011
- April 2011
- March 2011
- February 2011
- January 2011
- November 2010
- October 2010
- September 2010
- August 2010
- July 2010
- June 2010
- April 2010
- March 2010
- January 2010
- December 2009
- November 2009
- August 2009
- July 2009
- May 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
Categories
Meta
How to use Windows Azure Profiling Tools in Visual Studio
Just recently, I have been looking for a tool to profile my Windows Azure application when it runs on Azure. Yeah most browsers have that F12 dev tools, but they just won’t cut it for what I want. What I didn’t know, is that I didn’t look very far. As it so happens, the Windows Azure SDK includes a profiler that will profile your app (including code) when it runs on Windows Azure.
Was a bit hesitant so I decided to test it myself.
Steps would be:
- Create an azure worker role with two functions, one is okay, and the other is really bad (performance hog)
- Deploy it and have it profiled
- Hopefully the profiler will be able to identify which function is better, or which one needs improvement
Sounds sensible enough J
So I fire up Visual Studio and create a worker role.
So, what to put.. friend of mine Jon Limjap pointed me here and here is what I have now:
///
<summary>
/// Function I got from Stackoverflow
///
</summary>
///
<param name=”stringLength”></param>
///
<returns></returns>
private
string RandomStringGood(int size)
{
System.Text.StringBuilder builder = new
StringBuilder();
Random random = new
Random();
char ch;
for (int i = 0; i < size; i++)
{
ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65)));
builder.Append(ch);
}
return builder.ToString();
}
///
<summary>
/// modified it to be a bad function (my specialty hahaha)
///
</summary>
///
<param name=”size”></param>
///
<returns></returns>
private
string RandomStringBad(int size)
{
String builder = string.Empty;
Random random = new
Random();
char ch;
for (int i = 0; i < size; i++)
{
ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65)));
builder += ch;
}
return builder.ToString();
}
Then I call them
public
override
void Run()
{
// This is a sample worker implementation. Replace with your logic.
Trace.WriteLine(“$projectname$ entry point called”, “Information”);
while (true)
{
RandomStringBad(1);
RandomStringGood(1);
Thread.Sleep(10000);
Trace.WriteLine(“Working”, “Information”);
}
}
Short, simple and should do the job (fingers crossed)
So, then I use the profiling tool.. I deploy this to my Azure Subscription using Visual Studio
With these settings
I checked Enable Profiling then published it.
Some waiting involved..
Took while but when it is ready..
You can start profiling the workerrole
Again some waiting
Then I saw something that caught my attention
So I guess there is something that will need to be done with the symbols. But my test app is just a barebones app so I guess there is no need to worry about that just now.
I tried visiting the browser version of the Azure management portal.. and it showed activity
Annndddddd... here are the results!
The profiler indicates that RandomStringBad uses more resources than RandomStringGood!
And clicking on that item on the list takes me to the code
So I guess it works!
3 Responses to How to use Windows Azure Profiling Tools in Visual Studio
Pingback: Friday Five–September 21, 2012 | UpSearchBI
Pingback: Friday Five–September 21, 2012 | UpSearchSQL
Pingback: Friday-Five Series: Featuring Blog Posts by MVPs Serena Yeoh, Eduardo Lorenzo & Nguyen Thuan « SEA MVPs Blog-A-Holic