I am using one of the classes written by John Skeet and modified it in a project.
Some Code..
public sealed class DataProvider
{
private static readonly DataProvider instance = new DataProvider();
static DataProvider() { }
private DataProvider() { }
public static DateTime InstanceStartDate;
public static DataProvider Instance
{
get
{
InstanceStartDate = DateTime.UTCNow;
// Set a Function Call Start Time..
return instance;
}
}
// Hundresds of functions will reside here....
public void FunctionNo150()
{
// Database call which can take say 5-10 seconds..
LongProcess();
// DONT WANT TO SET FUNCTION COMPLETE HERE BUT AT SAY SOME DESTRUCTOR
}
This will have lots of function in it which are calling another Dlls.
I can call the function like:
DataProvider.Instance.Function150();
I will have a timer which will run say after every 1 second and i need to detect if the function is taking too much time.
Now i can detect when a function is started by setting a static datetime variable.
BUT HOW can i find out the function is completed. Can i have some destructor or so?? where i will set the static variable function complete time rather than writing in every functions.
Any help is highly appreciated.