tools/profiler/csharp/ProfReport.cs
branchrefac-jit
changeset 2284 026da5437111
parent 2192 7602d7fb60d9
child 2288 15c77b21589a
     1.1 --- a/tools/profiler/csharp/ProfReport.cs	Fri Jul 11 06:51:21 2008 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,159 +0,0 @@
     1.4 -using System;
     1.5 -using System.Collections.Generic;
     1.6 -using System.Text;
     1.7 -using System.Xml;
     1.8 -
     1.9 -namespace profviewer
    1.10 -{
    1.11 -    enum ProfileType : int
    1.12 -    {
    1.13 -        ProfType_Unknown = 0,
    1.14 -        ProfType_Native,
    1.15 -        ProfType_Callback,
    1.16 -        ProfType_Function
    1.17 -    }
    1.18 -
    1.19 -    class ProfileItem
    1.20 -    {
    1.21 -        public string name;
    1.22 -        public double total_time;
    1.23 -        public uint num_calls;
    1.24 -        public double min_time;
    1.25 -        public double max_time;
    1.26 -        public ProfileType type;
    1.27 -
    1.28 -        public double AverageTime
    1.29 -        {
    1.30 -            get
    1.31 -            {
    1.32 -                return total_time / num_calls;
    1.33 -            }
    1.34 -        }
    1.35 -    }
    1.36 -
    1.37 -    class ProfileReport
    1.38 -    {
    1.39 -        public static string[] TypeStrings;
    1.40 -        private DateTime m_start_time;
    1.41 -        private double m_duration;
    1.42 -        private List<ProfileItem> m_Items;
    1.43 -
    1.44 -        public int Count
    1.45 -        {
    1.46 -            get
    1.47 -            {
    1.48 -                return m_Items.Count;
    1.49 -            }
    1.50 -        }
    1.51 -
    1.52 -        static ProfileReport()
    1.53 -        {
    1.54 -            TypeStrings = new string[4];
    1.55 -
    1.56 -            TypeStrings[0] = "unknown";
    1.57 -            TypeStrings[1] = "native";
    1.58 -            TypeStrings[2] = "callback";
    1.59 -            TypeStrings[3] = "function";
    1.60 -        }
    1.61 -
    1.62 -        public ProfileReport(string file)
    1.63 -        {
    1.64 -            bool in_profile;
    1.65 -            ProfileType type;
    1.66 -            string cur_report;
    1.67 -            XmlTextReader xml;
    1.68 -
    1.69 -            xml = new XmlTextReader(file);
    1.70 -            xml.WhitespaceHandling = WhitespaceHandling.None;
    1.71 -
    1.72 -            m_Items = new List<ProfileItem>();
    1.73 -
    1.74 -            type = ProfileType.ProfType_Unknown;
    1.75 -            in_profile = false;
    1.76 -            cur_report = null;
    1.77 -            while (xml.Read())
    1.78 -            {
    1.79 -                if (xml.NodeType == XmlNodeType.Element)
    1.80 -                {
    1.81 -                    if (xml.Name.CompareTo("profile") == 0)
    1.82 -                    {
    1.83 -                        int t;
    1.84 -                        in_profile = true;
    1.85 -                        m_duration = Double.Parse(xml.GetAttribute("uptime"));
    1.86 -                        m_start_time = new DateTime(1970, 1, 1, 0, 0, 0);
    1.87 -                        t = Int32.Parse(xml.GetAttribute("time"));
    1.88 -                        m_start_time = m_start_time.AddSeconds(t);
    1.89 -                    }
    1.90 -                    else if (in_profile)
    1.91 -                    {
    1.92 -                        if (xml.Name.CompareTo("report") == 0)
    1.93 -                        {
    1.94 -                            cur_report = xml.GetAttribute("name");
    1.95 -                            if (cur_report.CompareTo("natives") == 0)
    1.96 -                            {
    1.97 -                                type = ProfileType.ProfType_Native;
    1.98 -                            }
    1.99 -                            else if (cur_report.CompareTo("callbacks") == 0)
   1.100 -                            {
   1.101 -                                type = ProfileType.ProfType_Callback;
   1.102 -                            }
   1.103 -                            else if (cur_report.CompareTo("functions") == 0)
   1.104 -                            {
   1.105 -                                type = ProfileType.ProfType_Function;
   1.106 -                            }
   1.107 -                            else
   1.108 -                            {
   1.109 -                                type = ProfileType.ProfType_Unknown;
   1.110 -                            }
   1.111 -                        }
   1.112 -                        else if (xml.Name.CompareTo("item") == 0 && cur_report != null)
   1.113 -                        {
   1.114 -                            ProfileItem item;
   1.115 -
   1.116 -                            item = new ProfileItem();
   1.117 -                            item.name = xml.GetAttribute("name");
   1.118 -                            item.max_time = Double.Parse(xml.GetAttribute("maxtime"));
   1.119 -                            item.min_time = Double.Parse(xml.GetAttribute("mintime"));
   1.120 -                            item.num_calls = UInt32.Parse(xml.GetAttribute("numcalls"));
   1.121 -                            item.total_time = Double.Parse(xml.GetAttribute("totaltime"));
   1.122 -                            item.type = type;
   1.123 -                            m_Items.Add(item);
   1.124 -                        }
   1.125 -                    }
   1.126 -                }
   1.127 -                else if (xml.NodeType == XmlNodeType.EndElement)
   1.128 -                {
   1.129 -                    if (xml.Name.CompareTo("profile") == 0)
   1.130 -                    {
   1.131 -                        break;
   1.132 -                    }
   1.133 -                    else if (xml.Name.CompareTo("report") == 0)
   1.134 -                    {
   1.135 -                        cur_report = null;
   1.136 -                    }
   1.137 -                }
   1.138 -            }
   1.139 -        }
   1.140 -
   1.141 -        public double Duration
   1.142 -        {
   1.143 -            get
   1.144 -            {
   1.145 -                return m_duration;
   1.146 -            }
   1.147 -        }
   1.148 -
   1.149 -        public DateTime StartTime
   1.150 -        {
   1.151 -            get
   1.152 -            {
   1.153 -                return m_start_time;
   1.154 -            }
   1.155 -        }
   1.156 -
   1.157 -        public ProfileItem GetItem(int i)
   1.158 -        {
   1.159 -            return m_Items[i];
   1.160 -        }
   1.161 -    }
   1.162 -}