<commit_before>﻿using System;
using System.Collections.Generic;
using Ampla.LogReader.Excel;
using Ampla.LogReader.Excel.Writer;
using Ampla.LogReader.Remoting;
using Ampla.LogReader.Statistics;

namespace Ampla.LogReader.Reports.Pages
{
    public class RemotingSummaryPage : ReportPage<RemotingEntry>
    {
        private readonly RemotingSummaryStatistic summaryStatistic;
        private readonly TopNStatistics<RemotingEntry> top10IdentityStats;
        private readonly TopNStatistics<RemotingEntry> top10MethodStats;

        public RemotingSummaryPage(IExcelSpreadsheet excelSpreadsheet, List<RemotingEntry> entries)
            : base(excelSpreadsheet, entries, "Summary")
        {
            summaryStatistic = new RemotingSummaryStatistic("Summary");
            top10IdentityStats = new TopNStatistics<RemotingEntry>
                ("Top 20 Identities", 20,
                 entry => entry.Identity,
                 entry => true);

            top10MethodStats = new TopNStatistics<RemotingEntry>
                ("Top 20 Methods", 20,
                 entry => entry.Method,
                 entry => true);
        }

        protected override void RenderPage(IWorksheetWriter writer)
        {
            UpdateStatistics(new IStatistic<RemotingEntry>[] {summaryStatistic, top10IdentityStats, top10MethodStats});

            writer.WriteRow("Summary of Remoting calls");
            if (summaryStatistic.Count > 0)
            {
                writer.WriteRow("Count: ", summaryStatistic.Count);
                writer.WriteRow("From: ", summaryStatistic.FirstEntry.ToLocalTime());
                writer.WriteRow("To: ", summaryStatistic.LastEntry.ToLocalTime());
                writer.WriteRow("Duration (hrs): ", summaryStatistic.LastEntry.Subtract(summaryStatistic.FirstEntry).TotalHours);

                var current = writer.GetCurrentCell();
                writer.WriteRow();

                WriteStatistics(top10MethodStats, writer);

                writer.MoveTo(current.Row, current.Column + 3);
                writer.WriteRow();

                WriteStatistics(top10IdentityStats, writer);
            }
            else<commit_msg>Change Remoting Summary to show top 50<commit_after>﻿using System;
using System.Collections.Generic;
using Ampla.LogReader.Excel;
using Ampla.LogReader.Excel.Writer;
using Ampla.LogReader.Remoting;
using Ampla.LogReader.Statistics;

namespace Ampla.LogReader.Reports.Pages
{
    public class RemotingSummaryPage : ReportPage<RemotingEntry>
    {
        private readonly RemotingSummaryStatistic summaryStatistic;
        private readonly TopNStatistics<RemotingEntry> top50IdentityStats;
        private readonly TopNStatistics<RemotingEntry> top50MethodStats;

        public RemotingSummaryPage(IExcelSpreadsheet excelSpreadsheet, List<RemotingEntry> entries)
            : base(excelSpreadsheet, entries, "Summary")
        {
            summaryStatistic = new RemotingSummaryStatistic("Summary");
            top50IdentityStats = new TopNStatistics<RemotingEntry>
                ("Top 50 Identities", 50,
                 entry => entry.Identity,
                 entry => true);

            top50MethodStats = new TopNStatistics<RemotingEntry>
                ("Top 50 Methods", 50,
                 entry => entry.Method,
                 entry => true);
        }

        protected override void RenderPage(IWorksheetWriter writer)
        {
            UpdateStatistics(new IStatistic<RemotingEntry>[] {summaryStatistic, top50IdentityStats, top50MethodStats});

            writer.WriteRow("Summary of Remoting calls");
            if (summaryStatistic.Count > 0)
            {
                writer.WriteRow("Count: ", summaryStatistic.Count);
                writer.WriteRow("From: ", summaryStatistic.FirstEntry.ToLocalTime());
                writer.WriteRow("To: ", summaryStatistic.LastEntry.ToLocalTime());
                writer.WriteRow("Duration (hrs): ", summaryStatistic.LastEntry.Subtract(summaryStatistic.FirstEntry).TotalHours);

                var current = writer.GetCurrentCell();
                writer.WriteRow();

                WriteStatistics(top50MethodStats, writer);

                writer.MoveTo(current.Row, current.Column + 3);
                writer.WriteRow();

                WriteStatistics(top50IdentityStats, writer);
            }
            else
{'fraction_non_alphanumeric': 0.08777142857142857, 'fraction_numerical': 0.012342857142857143, 'mean_word_length': 2.4980015987210233, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1084023', 'n_tokens_mistral': 1156, 'n_tokens_neox': 1059, 'n_words': 209}