OpenMinecraft.Profiler.ToString C# (CSharp) Method

ToString() public method

public ToString ( ) : string
return string
        public override string ToString()
        {
            if (numSamples == 0)
                return string.Format("[PROFILER] Operation {0} has no samples to work with.",Operation);
            long min = fastestRun;//*nanosecPerTick;
            long max = slowestRun;//*nanosecPerTick;
            long avg = numMS/numSamples;
            return string.Format("[PROFILER] Operation {0} complete with {1} sample(s) - Min: {2} ms, Max: {3} ms, Avg: {4} ms", Operation, numSamples, min, max, avg);
        }

Usage Example

Example #1
0
        public Cave(ref Random rnd, ref IMapHandler mh, Vector3i StartingPoint)
        {
            mMap = mh;
            rand = rnd;
            AddPoint(StartingPoint);
            // We need at least 4 points.
            int numPoints2Make = rand.Next(3, 10);
            for(int i=0;i<numPoints2Make;i++)
            {
                i++;
                AddPoint(new Vector3i(StartingPoint.X+rand.Next(-16, 16), StartingPoint.Y+rand.Next(-16, 16), StartingPoint.Z+rand.Next(-16, 16)));
            }
            Profiler profSphere = new Profiler("MakeSphere");
            Profiler profSpline = new Profiler("GetInterpolatedSplinePoint");
            int rad = rand.Next(1, 3);
            for(int p = 0;p<20;p++)
            {
                double t = (double)p/(double)(Points.Count*32);
                // Between 2/10 radius.
                profSpline.Start();
                Vector3i derp = this.GetInterpolatedSplinePoint(t);
                profSpline.Stop();

                mMap.SetBlockAt(derp.X, derp.Y, derp.Z, 0);

                profSphere.Start();
                MakeSphere(derp, rad);
                profSphere.Stop();
                //Console.WriteLine("MakeSphere r={0} @ t={1}", rad, t);
                //t += 0.05;
            }
            mMap.SaveAll();
            Console.WriteLine(profSpline.ToString());
            Console.WriteLine(profSphere.ToString());
        }
All Usage Examples Of OpenMinecraft.Profiler::ToString