<commit_before>﻿// Copyright 2014 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using System;
using System.IO;
using System.Linq;
using System.Xml.Linq;

namespace CombineBenchmarks
{
    /// <summary>
    /// Just a tiny utility to produce index.txt and benchmarks.xml for the Noda Time web site.
    /// </summary>
    class Program
    {
        static int Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("Usage: CombineBenchmarks <directory containing XML benchmarks>");
                return 1;
            }
            var directory = args[0];
            var index = Path.Combine(directory, "index.txt");
            var output = Path.Combine(directory, "benchmarks.xml");
            var files = Directory.GetFiles(directory, "*.xml")
                                 .Where(x => Path.GetFileName(x) != "benchmarks.xml")
                                 .ToList();
            File.WriteAllLines(index, files.Select(Path.GetFileName).ToArray());
            var doc = new XDocument(new XElement("benchmarks", files.Select(XElement.Load)));
            doc.Save(output);
            return 0;
        }
    }
}<commit_msg>Add a little bit of logging to CombineBenchmarks to help diagnose issue #362.<commit_after>﻿// Copyright 2014 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using System;
using System.IO;
using System.Linq;
using System.Xml.Linq;

namespace CombineBenchmarks
{
    /// <summary>
    /// Just a tiny utility to produce index.txt and benchmarks.xml for the Noda Time web site.
    /// </summary>
    class Program
    {
        static int Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("Usage: CombineBenchmarks <directory containing XML benchmarks>");
                return 1;
            }
            var directory = args[0];
            Console.WriteLine($"Processing benchmarks in {directory}");
            var index = Path.Combine(directory, "index.txt");
            var output = Path.Combine(directory, "benchmarks.xml");
            var files = Directory.GetFiles(directory, "*.xml")
                                 .Where(x => Path.GetFileName(x) != "benchmarks.xml")
                                 .ToList();
            File.WriteAllLines(index, files.Select(Path.GetFileName).ToArray());
            var doc = new XDocument(new XElement("benchmarks", files.Select(XElement.Load)));
            doc.Save(output);
            Console.WriteLine($"Updated index and combined file with {files.Count} benchmarks");
            return 0;
        }
    }
}
{'fraction_non_alphanumeric': 0.11079646017699116, 'fraction_numerical': 0.008141592920353982, 'mean_word_length': 1.9778714436248683, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3726579', 'n_tokens_mistral': 759, 'n_tokens_neox': 725, 'n_words': 228}