Visual Studio 宏 - 记录解决方案打开、关闭、构建等的时间戳
我有一个需要一段时间才能打开的解决方案。 (5 分钟)由于我们的流程和程序,我经常在同一解决方案的不同分支之间跳转。我每天都会多次关闭和加载同一解决方案的不同变体。这已经超过 15 分钟了,光是等待我的 Visual Studio 就浪费了 30 分钟。我将罪魁祸首归咎于过时的计算机硬件。我想捕获解决方案加载时间以及构建时间的指标。我的目标是将这些指标呈现给管理层。
我正在使用 Visual Studio 宏来跟踪此信息。
就目前情况而言,我正在记录这三个事件 EnvDTE.SolutionEvents.BeforeClosing、EnvDTE.SolutionEvents.AfterClosing、EnvDTE.SolutionEvents.Opened 的时间戳。
问题是,SolutionEvents.Opened 在整个解决方案加载后触发。我需要从开始加载解决方案到完成时生成时间戳。
如何查明 Visual Studio 何时开始加载解决方案?以便我可以将其与完成加载的时间进行比较。
下面是我的代码(我的 LogWithTimeStamp() 函数只是将字符串写入以当前时间戳为前缀的文件中:
Private Sub SolutionEvents_BeforeClosing() Handles SolutionEvents.BeforeClosing
LogWithTimeStamp("SolutionEvents.BeforeClosing")
End Sub
Private Sub SolutionEvents_AfterClosing() Handles SolutionEvents.AfterClosing
LogWithTimeStamp("SolutionEvents.AfterClosing")
End Sub
Private Sub SolutionEvents_Opened() Handles SolutionEvents.Opened
LogWithTimeStamp("SolutionEvents.Opened")
End Sub
I've got a solution that takes a while to open. (5 minutes) Due to our processes and procedures I'm constantly jumping around between different branches of the same solution. I'm constantly closing and loading different variations of the same solution more than a few times a day. That's over 15 minutes - 30 minutes wasted just wating for my Visual Studio. I'm blaming the outdated computer hardware as the culprit. I want to capture metrics of how long solutions are taking to load as well as how long build times are taking. My goal is to present these metrics to management.
I'm using Visual Studio Macros to track this information.
As it stands right now I'm logging time stamps on these three events EnvDTE.SolutionEvents.BeforeClosing, EnvDTE.SolutionEvents.AfterClosing, EnvDTE.SolutionEvents.Opened.
The problem is, the SolutionEvents.Opened fires after the entire solution has been loaded. I need to generate a timestamp from when I start to load the solution and when it finishes.
How can I find out when Visual Studio starts loading the solution? So that I can compare it to when it finished loading.
Below is my code (My LogWithTimeStamp() function just writes the string to a file with the current timestamp as a prefix:
Private Sub SolutionEvents_BeforeClosing() Handles SolutionEvents.BeforeClosing
LogWithTimeStamp("SolutionEvents.BeforeClosing")
End Sub
Private Sub SolutionEvents_AfterClosing() Handles SolutionEvents.AfterClosing
LogWithTimeStamp("SolutionEvents.AfterClosing")
End Sub
Private Sub SolutionEvents_Opened() Handles SolutionEvents.Opened
LogWithTimeStamp("SolutionEvents.Opened")
End Sub
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论