Profile.cs 780 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
  2. //
  3. // Profile.cs
  4. //
  5. // Author:
  6. // Jason Diamond ([email protected])
  7. //
  8. // (C) 2001 Jason Diamond http://injektilo.org/
  9. //
  10. using System;
  11. using System.Xml;
  12. using System.IO;
  13. using System.Text;
  14. public class Profile
  15. {
  16. public static void Main(string[] args)
  17. {
  18. XmlReader xmlReader = null;
  19. if (args.Length < 1)
  20. {
  21. xmlReader = new XmlTextReader(Console.In);
  22. }
  23. else
  24. {
  25. xmlReader = new XmlTextReader(args[0]);
  26. }
  27. int nodes = 0;
  28. DateTime start = DateTime.Now;
  29. while (xmlReader.Read())
  30. {
  31. ++nodes;
  32. }
  33. DateTime end = DateTime.Now;
  34. Console.WriteLine("time = {0}", end - start);
  35. Console.WriteLine("nodes = {0}", nodes);
  36. }
  37. }