public override string ToString()
        {
            uint Total, True, Top, Bottom, False;
            ComputeStatistics(totalStatistics.Values, out Total, out True, out Top, out Bottom, out False);

            return AnalysisStatistics.PrettyPrint(Total, True, Top, Bottom, False);
        }
        public AnalysisStatistics OverallStatistics()
        {
            var result = new AnalysisStatistics();
            ComputeStatistics(totalStatistics.Values, out result.Total, out result.True, out result.Top, out result.Bottom, out result.False);

            return result;
        }
        public AnalysisStatistics OverallStatistics()
        {
            var result = new AnalysisStatistics();
            ComputeStatistics(totalStatistics.Values, out result.Total, out result.True, out result.Top, out result.Bottom, out result.False);

            return result;
        }
        public static ClousotAnalysisResults EmitStats(this AnalysisStatistics @this, int swallowedTop, int swallowedBottom, int swallowedFalse, string assemblyName, IOutputResults output)
        {
            Contract.Requires(swallowedTop >= 0);
            Contract.Requires(swallowedBottom >= 0);
            Contract.Requires(swallowedFalse >= 0);
            Contract.Requires(assemblyName != null);
            Contract.Ensures(Contract.Result <ClousotAnalysisResults>() != null);

            var result = new ClousotAnalysisResults();

            if (@this.Total > 0)
            {
                var True   = @this.True;
                var Top    = Math.Max(@this.Top - swallowedTop, 0);
                var Bottom = Math.Max(@this.Bottom - swallowedBottom, 0);
                var False  = Math.Max(@this.False - swallowedFalse, 0);

                var Total = True + Top + Bottom + False;

                var masked = swallowedTop + swallowedFalse + swallowedBottom;

                Contract.Assert(masked >= 0);

                Contract.Assert(Top >= 0);
                Contract.Assert(Bottom >= 0);
                Contract.Assert(False >= 0);

                var stats = String.Format("Checked {0} assertion{1}: {2}{3}{4}{5}{6}",
                                          @this.Total.ToString(),
                                          @this.Total > 1 ? "s" : "",
                                          True > 0 ? True + " correct " : "",
                                          Top > 0 ? Top + " unknown " : "",
                                          Bottom > 0 ? Bottom + " unreached " : "",
                                          False > 0 ? False + " false" : "",
                                          masked > 0 ? "(" + masked + " masked)" : "");

                output.FinalStatistic(assemblyName, stats);

                double precision = Total != 0 ? True / (double)Total : 1.0;
                output.Statistic("Validated: {0,6:P1}", precision);

                // for scripts parsing msbuild output
                output.WriteLine(stats);

                // Update the result
                result.Total  = @this.Total;
                result.True   = True;
                result.False  = False;
                result.Bottom = Bottom;
                result.Top    = Top;
                result.Masked = masked;
            }
            else
            {
                output.FinalStatistic(assemblyName, "Checked 0 assertions.");
            }

            return(result);
        }
示例#5
0
 public void ResetCachedOutcomes()
 {
     foreach (var obl in this.obligations)
     {
         obl.ResetCachedOutcome();
     }
     stats = new AnalysisStatistics();
 }
        public void Add(AnalysisStatistics right)
        {
            Contract.Assert(right.True >= 0);
            Contract.Assert(right.Top >= 0);
            Contract.Assert(right.False >= 0);
            Contract.Assert(right.Bottom >= 0);
            Contract.Assume(right.Total == right.True + right.Top + right.False + right.Bottom);

            this.Total  += right.Total;
            this.Top    += right.Top;
            this.Bottom += right.Bottom;
            this.True   += right.True;
            this.False  += right.False;
        }
 public void Add(object method, AnalysisStatistics stat, MethodClassification methodKind)
 {
     totalStatistics[method] = stat;
 }
 public void Add(object method, AnalysisStatistics stat, MethodClassification methodKind)
 {
     totalStatistics[method] = stat;
 }
        public void Add(AnalysisStatistics right)
        {
            Contract.Assert(right.True >= 0);
            Contract.Assert(right.Top >= 0);
            Contract.Assert(right.False >= 0);
            Contract.Assert(right.Bottom >= 0);
            Contract.Assume(right.Total == right.True + right.Top + right.False + right.Bottom);

            this.Total += right.Total;
            this.Top += right.Top;
            this.Bottom += right.Bottom;
            this.True += right.True;
            this.False += right.False;
        }