add additional time measurements

pull/239/head
Valentin Zickner 3 years ago committed by Thomas
parent 24dc312367
commit f1b3c61675

@ -27,6 +27,8 @@ export class PortfolioCalculator {
) {}
public computeTransactionPoints(orders: PortfolioOrder[]) {
console.time('compute-transaction-points');
orders.sort((a, b) => a.date.localeCompare(b.date));
this.transactionPoints = [];
@ -90,6 +92,7 @@ export class PortfolioCalculator {
}
lastDate = currentDate;
}
console.timeEnd('compute-transaction-points');
}
public setTransactionPoints(transactionPoints: TransactionPoint[]) {
@ -139,6 +142,8 @@ export class PortfolioCalculator {
if (timelineSpecification.length === 0) {
return [];
}
console.time('calculate-timeline-total');
console.time('calculate-timeline-calculations');
const startDate = timelineSpecification[0].start;
const start = dparse(startDate);
@ -166,6 +171,7 @@ export class PortfolioCalculator {
}
timelinePeriodPromises.push(this.getTimePeriodForDate(j, currentDate));
}
console.timeEnd('calculate-timeline-calculations');
console.time('calculate-timeline-periods');
@ -174,6 +180,7 @@ export class PortfolioCalculator {
);
console.timeEnd('calculate-timeline-periods');
console.timeEnd('calculate-timeline-total');
return timelinePeriods;
}

@ -91,11 +91,12 @@ export class PortfolioController {
@Res() res: Response
): Promise<HistoricalDataItem[]> {
console.time('get-chart-request');
console.time('portfolio-service-get-chart');
let chartData = await this.portfolioService.getChart(
impersonationId,
range
);
console.timeEnd('portfolio-service-get-chart');
let hasNullValue = false;

@ -151,15 +151,19 @@ export class PortfolioService {
aImpersonationId: string,
aDateRange: DateRange = 'max'
): Promise<HistoricalDataItem[]> {
console.time('impersonation-service');
const impersonationUserId =
await this.impersonationService.validateImpersonationId(
aImpersonationId,
this.request.user.id
);
console.timeEnd('impersonation-service');
console.time('create-portfolio');
const portfolio = await this.createPortfolio(
impersonationUserId || this.request.user.id
);
console.timeEnd('create-portfolio');
const orders = portfolio.getOrders();
if (orders.length <= 0) {

Loading…
Cancel
Save