Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Time taken to load a contrl

Time taken to load a contrl

Scheduled Pinned Locked Moved C#
designperformancequestion
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Subin Mavunkal
    wrote on last edited by
    #1

    Hi whats the accurate and best method to get the time taken to load a control.?.Any idea ?.(I am writing a performance monitoring UI test.) With thanxx and regards

    B V L B 4 Replies Last reply
    0
    • S Subin Mavunkal

      Hi whats the accurate and best method to get the time taken to load a control.?.Any idea ?.(I am writing a performance monitoring UI test.) With thanxx and regards

      B Offline
      B Offline
      BillWoodruff
      wrote on last edited by
      #2

      I think to get a good answer to this question you need to tell us exactly what you mean by "load a control." Are you talking about how long it takes to "fill" a databound object, like a ListView, with thousands of rows from its source ? Are you talking about how long it takes, from the time an end-user double-clicks on a compiled .NET .exe file to present a Window (WPF, WinForms ?) with many controls ... the contents/settings of which ... all (or some) ... need to be calculated when the application launches, rather than being "static," or read in from Application.Settings or other resources ?

      "It is the mark of an educated mind to be able to entertain a thought without accepting it." Aristotle

      1 Reply Last reply
      0
      • S Subin Mavunkal

        Hi whats the accurate and best method to get the time taken to load a control.?.Any idea ?.(I am writing a performance monitoring UI test.) With thanxx and regards

        V Offline
        V Offline
        V 0
        wrote on last edited by
        #3

        Difficult question. The fact that you are timing the "load" might implicate the "load" itself, making it slower. Do you need this on the live system or just for dev and/or test environment?

        V.

        1 Reply Last reply
        0
        • S Subin Mavunkal

          Hi whats the accurate and best method to get the time taken to load a control.?.Any idea ?.(I am writing a performance monitoring UI test.) With thanxx and regards

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          Use the StopWatch class, call Start() right before and Stop() right after the execution of the code you're interested in. I don't know what you mean by "load a control"; with all the events going on in a WinForms Form when opening up a new Form, it may well be that your control is touched in the Form's constructor, and several event handlers such as Load and Shown. And that other controls also get handled at around the same time. You might even have to deal with an extra Control which you handle all at once, using your own run-time code only. Warning: if lots of data is loaded into the control (such as a DataGridView fed by a database), how you organize the data load will predominate, not the generating and painting of the control itself; unless you have coded a large number of operations on a single control and you've forgotten to make good use of optimizing calls such as Control.SuspendLayout() and the like. :)

          Luc Pattyn [My Articles] Nil Volentibus Arduum

          1 Reply Last reply
          0
          • S Subin Mavunkal

            Hi whats the accurate and best method to get the time taken to load a control.?.Any idea ?.(I am writing a performance monitoring UI test.) With thanxx and regards

            B Offline
            B Offline
            BobJanova
            wrote on last edited by
            #5

            For a form you can time between the first line of the constructor and when the Load event[^] gets fired.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups