Click here to Skip to main content
15,895,799 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: code performance idea in team environment Pin
Marc Clifton17-Jan-17 13:52
mvaMarc Clifton17-Jan-17 13:52 
GeneralRe: code performance idea in team environment Pin
Super Lloyd17-Jan-17 14:11
Super Lloyd17-Jan-17 14:11 
GeneralRe: code performance idea in team environment PinPopular
Marc Clifton17-Jan-17 15:00
mvaMarc Clifton17-Jan-17 15:00 
GeneralRe: code performance idea in team environment Pin
Jon McKee17-Jan-17 19:49
professionalJon McKee17-Jan-17 19:49 
GeneralRe: code performance idea in team environment Pin
Dominic Burford17-Jan-17 23:58
professionalDominic Burford17-Jan-17 23:58 
GeneralRe: code performance idea in team environment Pin
Gary Wheeler18-Jan-17 6:51
Gary Wheeler18-Jan-17 6:51 
GeneralRe: code performance idea in team environment Pin
BillWoodruff17-Jan-17 14:47
professionalBillWoodruff17-Jan-17 14:47 
AnswerRe: code performance idea in team environment Pin
Super Lloyd17-Jan-17 14:55
Super Lloyd17-Jan-17 14:55 
The article hey?
Might do a tips and trick! Sniff | :^)

Meanwhile here are the relevant classes for your information:
C#
    public class TimedBlock : IDisposable
    {
        Stopwatch stopwatch;

        public TimedBlock([CallerMemberName] string name = null)
        {
            Name = name;
            stopwatch = new Stopwatch();
            stopwatch.Start();
        }
        public string Name { get; set; }
        public TimeSpan Elapsed { get { return stopwatch.Elapsed; } }

        public virtual void Dispose()
        {
            stopwatch.Stop();
            Trace.WriteLine($"TimedBlock({Name}, {Elapsed})");
        }
    }
    public class TimeCriticalBlock : TimedBlock
    {
        TimeSpan max;

        public TimeCriticalBlock(TimeSpan max, [CallerMemberName] string name = null)
            : base(name)
        {
            this.max = max;
        }

        public override void Dispose()
        {
            base.Dispose();
            if (Elapsed > max)
            {
                var msg = $"code too slow, {Name} took {Elapsed}.";
                Trace.Error(msg);
#if DEBUG
                if (Debugger.IsAttached)
                    Debugger.Break();
#endif
            }
        }
    }
A new .NET Serializer
All in one Menu-Ribbon Bar
Taking over the world since 1371!

GeneralRe: code performance idea in team environment Pin
_groo_18-Jan-17 1:44
_groo_18-Jan-17 1:44 
GeneralRe: code performance idea in team environment Pin
Super Lloyd18-Jan-17 3:23
Super Lloyd18-Jan-17 3:23 
GeneralRe: code performance idea in team environment Pin
Brisingr Aerowing17-Jan-17 15:11
professionalBrisingr Aerowing17-Jan-17 15:11 
GeneralRe: code performance idea in team environment Pin
Super Lloyd17-Jan-17 15:15
Super Lloyd17-Jan-17 15:15 
GeneralRe: code performance idea in team environment Pin
Sander Rossel17-Jan-17 21:45
professionalSander Rossel17-Jan-17 21:45 
GeneralRe: code performance idea in team environment Pin
Super Lloyd17-Jan-17 22:43
Super Lloyd17-Jan-17 22:43 
GeneralRe: code performance idea in team environment Pin
Sander Rossel17-Jan-17 22:59
professionalSander Rossel17-Jan-17 22:59 
GeneralRe: code performance idea in team environment Pin
Super Lloyd17-Jan-17 23:27
Super Lloyd17-Jan-17 23:27 
GeneralRe: code performance idea in team environment Pin
Super Lloyd17-Jan-17 23:30
Super Lloyd17-Jan-17 23:30 
GeneralRe: code performance idea in team environment Pin
den2k8817-Jan-17 23:54
professionalden2k8817-Jan-17 23:54 
GeneralRe: code performance idea in team environment Pin
Super Lloyd18-Jan-17 3:25
Super Lloyd18-Jan-17 3:25 
GeneralRe: code performance idea in team environment Pin
BillWoodruff18-Jan-17 5:09
professionalBillWoodruff18-Jan-17 5:09 
GeneralRe: code performance idea in team environment Pin
Sander Rossel18-Jan-17 5:15
professionalSander Rossel18-Jan-17 5:15 
GeneralRe: code performance idea in team environment Pin
patbob18-Jan-17 4:49
patbob18-Jan-17 4:49 
NewsFired IT worker wants $200K to release former employer's changed password Pin
Cornelius Henning17-Jan-17 10:05
professionalCornelius Henning17-Jan-17 10:05 
GeneralRe: Fired IT worker wants $200K to release former employer's changed password Pin
Jon McKee17-Jan-17 10:16
professionalJon McKee17-Jan-17 10:16 
GeneralRe: Fired IT worker wants $200K to release former employer's changed password Pin
Cornelius Henning17-Jan-17 10:26
professionalCornelius Henning17-Jan-17 10:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.