示例#1
0
文件: Alerts.cs 项目: ahorn/z3test
        public Alerts(Job j, string linkPage)
        {
            _job = j;
            _linkPage = linkPage;

            foreach (string c in _job.Summary.Categories)
                if (c != "")
                    alertSets.Add(c, FindAlerts(c));

            AlertSet overall = new AlertSet();
            foreach (KeyValuePair<string, AlertSet> kvp in alertSets)
            {
                if (kvp.Key != "" && kvp.Value.Messages.Count != 0)
                    overall.Add(kvp.Value.Level,
                        string.Format("{0} alert{1} in <a href='" + _linkPage + "?cat={2}' style='text-decoration:none;'>{2}</a>.", kvp.Value.Count, kvp.Value.Count == 1 ? "" : "s", kvp.Key));
            }
            alertSets.Add("", overall);
        }
示例#2
0
        public Panel buildAlertMessages(AlertSet cas, string zero_message)
        {
            Panel res = new Panel();

            if (cas.Count == 0)
            {
                Panel lp = new Panel();
                lp.Controls.Add(buildAlertImage(AlertLevel.None));
                Label l = new Label();
                l.Text = zero_message;
                l.ForeColor = Color.Green;
                l.Style["vertical-align"] = "middle";
                l.Style["margin-left"] = "5px";
                lp.Controls.Add(l);
                res.Controls.Add(lp);
            }
            else
            {
                if (cas.Messages.ContainsKey(AlertLevel.Critical))
                    foreach (string s in cas.Messages[AlertLevel.Critical])
                    {
                        Panel lp = new Panel();
                        lp.Controls.Add(buildAlertImage(AlertLevel.Critical));
                        Label l = new Label();
                        l.Text = s;
                        l.ForeColor = Color.Red;
                        l.Style["vertical-align"] = "middle";
                        l.Style["margin-left"] = "5px";
                        lp.Controls.Add(l);
                        res.Controls.Add(lp);
                    }

                if (cas.Messages.ContainsKey(AlertLevel.Warning))
                    foreach (string s in cas.Messages[AlertLevel.Warning])
                    {
                        Panel lp = new Panel();
                        lp.Controls.Add(buildAlertImage(AlertLevel.Warning));
                        Label l = new Label();
                        l.Text = s;
                        l.ForeColor = Color.Orange;
                        l.Style["vertical-align"] = "middle";
                        l.Style["margin-left"] = "5px";
                        lp.Controls.Add(l);
                        res.Controls.Add(lp);
                    }

                if (cas.Messages.ContainsKey(AlertLevel.None))
                    foreach (string s in cas.Messages[AlertLevel.None])
                    {
                        Panel lp = new Panel();
                        lp.Controls.Add(buildAlertImage(AlertLevel.None));
                        Label l = new Label();
                        l.Text = s;
                        l.ForeColor = Color.Green;
                        l.Style["vertical-align"] = "middle";
                        l.Style["margin-left"] = "5px";
                        lp.Controls.Add(l);
                        res.Controls.Add(lp);
                    }
            }

            return res;
        }
示例#3
0
文件: Alerts.cs 项目: ahorn/z3test
        protected AlertSet FindAlerts(string cat)
        {
            AlertSet res = new AlertSet();

            // Check for bugs != 0; This is critical.
            uint bugs = (cat == "") ? _job.Summary.Overall.Bugs : _job.Summary[cat].Bugs;
            if (bugs != 0)
            {
                res.Add(AlertLevel.Critical,
                    string.Format("There {0} {1} bug{2}.", bugs == 1 ? "is" : "are", bugs, bugs == 1 ? "" : "s"));
            }

            // Infrastructure errors; this is just an information.
            uint ierrs = (cat == "") ? _job.Summary.Overall.InfrastructureErrors : _job.Summary[cat].InfrastructureErrors;
            if (ierrs != 0)
            {
                res.Add(AlertLevel.None,
                    string.Format("There {0} {1} infrastructure error{2}.", ierrs == 1 ? "is" : "are", ierrs, ierrs == 1 ? "" : "s"));
            }

            // Check for errors != 0; this is just a warning.
            uint errors = (cat == "") ? _job.Summary.Overall.Errors : _job.Summary[cat].Errors;
            if (errors != 0)
            {
                res.Add(AlertLevel.Warning,
                    string.Format("There {0} {1} error{2}.", errors == 1 ? "is" : "are", errors, errors == 1 ? "" : "s"));
            }

            // See whether something got slower.
            int dippers = (cat == "") ? _job.Dippers[""].Count : _job.Dippers[cat].Count;
            if (dippers != 0)
            {
                res.Add(AlertLevel.None,
                    string.Format("There {0} {1} benchmark{2} that show{3} a dip in performance.",
                                    dippers == 1 ? "is" : "are", dippers,
                                    dippers == 1 ? "" : "s",
                                    dippers == 1 ? "s" : ""));
            }

            return res;
        }