{"id":631,"date":"2022-07-12T02:35:04","date_gmt":"2022-07-12T02:35:04","guid":{"rendered":"http:\/\/draith.com\/?p=631"},"modified":"2023-01-09T02:48:52","modified_gmt":"2023-01-09T02:48:52","slug":"stopwatch-vs-measure-command","status":"publish","type":"post","link":"http:\/\/draith.com\/?p=631","title":{"rendered":"Stopwatch vs Measure-Command"},"content":{"rendered":"\n<p>Just a quick one &#8211; consider using the Stopwatch class instead of Measure-Command in PowerShell.  There are a couple of good reasons that you might want to:<\/p>\n\n\n\n<p>First off you get more granular measuring units.  While this is not normally an issue for normal performance troubleshooting, there might be very unique circumstances where you need to get sub-millisecond.<\/p>\n\n\n\n<p>In my opinion the main reason to use the stopwatch class is the enhanced control it has.  You can stop and restart the stopwatch at any time.  You can specifically start the stopwatch, run some commands, stop the stopwatch, run more commands, and then restart it without having to add together 2 or more measure-commands.  You also get the ability to zero out the stopwatch anytime you want.  You can also have multiple stopwatches running at the same time!<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"748\" src=\"\/wp-content\/uploads\/2023\/01\/image-1024x748.png\" alt=\"\" class=\"wp-image-632\" srcset=\"\/wp-content\/uploads\/2023\/01\/image-1024x748.png 1024w, \/wp-content\/uploads\/2023\/01\/image-300x219.png 300w, \/wp-content\/uploads\/2023\/01\/image-768x561.png 768w, \/wp-content\/uploads\/2023\/01\/image-1200x877.png 1200w, \/wp-content\/uploads\/2023\/01\/image.png 1243w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Just a quick one &#8211; consider using the Stopwatch class instead of Measure-Command in PowerShell. There are a couple of good reasons that you might want to: First off you get more granular measuring units. While this is not normally an issue for normal performance troubleshooting, there might be very unique circumstances where you need &hellip; <a href=\"http:\/\/draith.com\/?p=631\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Stopwatch vs Measure-Command&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-631","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/draith.com\/index.php?rest_route=\/wp\/v2\/posts\/631","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/draith.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/draith.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/draith.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/draith.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=631"}],"version-history":[{"count":1,"href":"http:\/\/draith.com\/index.php?rest_route=\/wp\/v2\/posts\/631\/revisions"}],"predecessor-version":[{"id":633,"href":"http:\/\/draith.com\/index.php?rest_route=\/wp\/v2\/posts\/631\/revisions\/633"}],"wp:attachment":[{"href":"http:\/\/draith.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=631"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/draith.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=631"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/draith.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}