Add profiling to MarketDataServer controllers
This commit is contained in:
@@ -21,9 +21,10 @@ namespace MarketDataServer.Controllers
|
||||
[HttpGet]
|
||||
public IEnumerable<GainLossSummaryItem> GetGainLossByDate(String token,DateTime selectedDate)
|
||||
{
|
||||
Profiler profiler = new Profiler();
|
||||
try
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][GainLossController::GetGainLoss](String token, DateTime selectedDate)", DateTime.Now));
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
|
||||
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
||||
LocalPriceCache.GetInstance().Refresh();
|
||||
PortfolioTrades portfolioTrades = PortfolioDA.GetTrades();
|
||||
@@ -59,14 +60,19 @@ namespace MarketDataServer.Controllers
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IEnumerable<GainLossSummaryItem> GetGainLossByDateAndAccount(String token,DateTime selectedDate,String account)
|
||||
{
|
||||
Profiler profiler = new Profiler();
|
||||
try
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][GainLossController::GetGainLoss](String token, DateTime selectedDate,String account)", DateTime.Now));
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
|
||||
LocalPriceCache.GetInstance().Refresh();
|
||||
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
||||
PortfolioTrades portfolioTrades = PortfolioDA.GetTrades();
|
||||
@@ -103,14 +109,19 @@ namespace MarketDataServer.Controllers
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IEnumerable<GainLossSummaryItemDetail> GetGainLossWithDetailByDate(String token,DateTime selectedDate)
|
||||
{
|
||||
Profiler profiler = new Profiler();
|
||||
try
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][GainLossController::GetGainLossWithDetail](String token, DateTime selectedDate)", DateTime.Now));
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
|
||||
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
||||
LocalPriceCache.GetInstance().Refresh();
|
||||
PortfolioTrades portfolioTrades = PortfolioDA.GetTrades();
|
||||
@@ -197,14 +208,19 @@ namespace MarketDataServer.Controllers
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IEnumerable<GainLossSummaryItemDetail> GetGainLossWithDetailByDateAndAccount(String token, DateTime selectedDate, String account)
|
||||
{
|
||||
Profiler profiler = new Profiler();
|
||||
try
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][GainLossController::GetGainLossWithDetail](String token, DateTime selectedDate,String account)", DateTime.Now));
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
|
||||
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
||||
LocalPriceCache.GetInstance().Refresh();
|
||||
PortfolioTrades portfolioTrades = PortfolioDA.GetTrades();
|
||||
@@ -292,14 +308,19 @@ namespace MarketDataServer.Controllers
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetCompoundGainLoss")]
|
||||
public GainLossCompoundModelCollection GetCompoundGainLoss(String token, int selectedDays, bool includeDividends)
|
||||
{
|
||||
Profiler profiler = new Profiler();
|
||||
try
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][GainLossController::GetCompundGainLoss](String token, int days)", DateTime.Now));
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
|
||||
if(!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
||||
LocalPriceCache.GetInstance().Refresh();
|
||||
DividendPayments dividendPayments = null;
|
||||
@@ -323,6 +344,10 @@ namespace MarketDataServer.Controllers
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user