Пример #1
0
        /**
         * A new Trace made up of counts of this trace's indices.
         * @return
         */
        public CountsTrace makeCountsTrace()
        {
            CountsTrace trace = new CountsTrace(monitor, string.Format("# {0}", title));

            trace.items = items.Select(l => l.Count).ToList();
            return(trace);
        }
Пример #2
0
        /**
         * Trace made up of cumulative counts of trace indices.
         * @return
         */
        public CountsTrace makeCumCountsTrace()
        {
            CountsTrace trace       = new CountsTrace(monitor, string.Format("# (cumulative) {0}", title));
            Trace <int> countsTrace = makeCountsTrace();

            int[] accum = { 0 };
            trace.items = countsTrace.items.Select(i => accum[0] += ((int)i)).ToList();
            return(trace);
        }
Пример #3
0
        /**
         * Convenience method to compute a metric over an indices trace, excluding
         * resets.
         *
         * @param trace     Trace of indices
         * @return
         */
        public virtual Metric <int> mmGetMetricFromTrace(IndicesTrace trace)
        {
            List <HashSet <int> > data          = null;
            BoolsTrace            excludeResets = mmGetTraceResets();

            if (excludeResets != null)
            {
                int[] i = { 0 };
                data = trace.items.Where(t => !excludeResets.items[i[0]++]).ToList();
            }

            trace.items = data;
            CountsTrace iTrace = trace.makeCountsTrace();

            return(Metric <int> .createFromTrace(iTrace, mmGetTraceResets()));
        }