打破批量测试...... [英] break in batch testing...

查看:72
本文介绍了打破批量测试......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我正在使用C#程序运行批量测试。这通常需要几个小时

来运行并迭代一堆参数(比方说)1000次。


处理器在这段时间内达到最大值。 br />

我想提供一个取消批量测试的按钮

部分完成。


我正在考虑在

迭代之间放置一些Wait()或Pause()代码,如果按下Cancel按钮但是不确定则设置一个标志

如果这样可行。


实现此类事情的标准方法是什么?


谢谢

Hi,

I''m running a batch test using a C# program. This often takes several hours
to run and iterates over a bunch of parameters (say) 1000 times.

The processor is maxed out during this time.

I''d like to provide a button that cancels the batch test when it is
partially done.

I''m thinking about putting some Wait() or Pause() code in between the
iterations and then setting a flag if a Cancel button is pushed but not sure
if this would work.

What is the standard approach to implementing this sort of thing?

Thanks

推荐答案




我正在使用C#程序运行批量测试。这通常需要几个小时才能运行并迭代一堆参数(比方说)1000次。

处理器在这段时间内最大化。

我我想提供一个按钮,当它部分完成时取消批量测试。

我正在考虑在它们之间加入一些Wait()或Pause()代码。
迭代然后设置一个标志,如果按下取消按钮但不确定
这是否有效。

实现这类事情的标准方法是什么?
Hi,

I''m running a batch test using a C# program. This often takes several hours
to run and iterates over a bunch of parameters (say) 1000 times.

The processor is maxed out during this time.

I''d like to provide a button that cancels the batch test when it is
partially done.

I''m thinking about putting some Wait() or Pause() code in between the
iterations and then setting a flag if a Cancel button is pushed but not sure
if this would work.

What is the standard approach to implementing this sort of thing?




禁用所有UI控件但取消按钮。在迭代之间调用

Application.DoEvents(),比如说x

迭代。


再见

Rob



Disable all UI controls but the cancel button. Call
Application.DoEvents() between the iterations, say ever x
iterations.

bye
Rob


Robert Jordan< ro ***** @ gmx.net>写道:
Robert Jordan <ro*****@gmx.net> wrote:
我正在使用C#程序运行批量测试。这通常需要几个小时才能运行并迭代一堆参数(比方说)1000次。

处理器在这段时间内最大化。

我我想提供一个按钮,当它部分完成时取消批量测试。

我正在考虑在它们之间加入一些Wait()或Pause()代码。
迭代然后设置一个标志,如果按下取消按钮但不确定
这是否有效。

实现这类事情的标准方法是什么?
I''m running a batch test using a C# program. This often takes several hours
to run and iterates over a bunch of parameters (say) 1000 times.

The processor is maxed out during this time.

I''d like to provide a button that cancels the batch test when it is
partially done.

I''m thinking about putting some Wait() or Pause() code in between the
iterations and then setting a flag if a Cancel button is pushed but not sure
if this would work.

What is the standard approach to implementing this sort of thing?



禁用所有UI控件但取消按钮。在迭代之间调用Application.DoEvents(),比如说迭代次数。



Disable all UI controls but the cancel button. Call
Application.DoEvents() between the iterations, say ever x
iterations.




我不同意这一点,除了禁用所有UI控件。最好在单独的线程上运行迭代并测试一个标志。

Application.DoEvents()会导致像重入一样的肮脏。对于我的

介意,Application.DoEvents()基本上是对VB没有

正确的回击。穿线很长一段时间,应该避免在几乎所有

的情况下。


UI应该通过保持消息泵线程来保持响应

在尽可能多的时间内闲置。


-

Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet

如果回复小组,请不要给我发邮件



I disagree with this, apart from disabling all UI controls. It is
better to run the iterations on a separate thread and test for a flag.
Application.DoEvents() can cause nastiness like re-entrancy. To my
mind, Application.DoEvents() is basically a throw-back to VB not having
"proper" threading for a long time, and should be avoided in almost all
situations.

UIs should be kept responsive by keeping their message pump threads
idle for as much of the time as possible.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Jon Jon和Robert,


感谢您的回复。我尝试使用Application.DoEvents()建议

由Robert而不是禁用用户界面,它可以很好用。


Jon,你能详细说明吗?使用这个。


我基本上会弹出一个进展。报告时间过去的对话框和

%批量测试等的进度,此

对话框上有一个取消按钮。弹出此进度对话框的主代码检查

此类中的标志,如果设置则停止批量测试。单击

取消按钮设置此标志。我发现如果我不打算在

中调用.DoEvents(),则检查标志然后点击取消按钮不会设置

标志。 ..


谢谢

" Jon Skeet [C#MVP]" < SK *** @ pobox.com>在消息中写道

新闻:MP ************************ @ msnews.microsoft.c om ...
Hi Jon and Robert,

Thanks for the replies. I tried using the Application.DoEvents() suggested
by Robert but not the disable UI and it works a treat.

Jon, could you elaborate on not using this.

I''m basically popping up a "progress" dialog which reports time elapsed and
% progress through the batch test etc. and there is a Cancel button on this
dialog. The main code that popped up this progress dialog checks a flag in
this class and if set stops the batch testing. This flag is set by clicking
the Cancel button. I find that if I don''t inlcude the .DoEvents() call in
the check to the flag then clicking on the Cancel button does not set the
flag...

Thanks
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Robert Jordan< ro ***** @ gmx.net>写道:
Robert Jordan <ro*****@gmx.net> wrote:
>我正在使用C#程序进行批量测试。这往往需要几个
>小时
>运行并迭代一堆参数(比方说)1000次。
>
>处理器在此期间最大化。
>
>我想提供一个取消批量测试的按钮
>部分完成。
>
>我正在考虑在
>之间放置一些Wait()或Pause()代码。迭代,然后设置一个标志,如果按下取消按钮但不是
>确定
>如果这样可行。
>
>实现此类事情的标准方法是什么?
> I''m running a batch test using a C# program. This often takes several
> hours
> to run and iterates over a bunch of parameters (say) 1000 times.
>
> The processor is maxed out during this time.
>
> I''d like to provide a button that cancels the batch test when it is
> partially done.
>
> I''m thinking about putting some Wait() or Pause() code in between the
> iterations and then setting a flag if a Cancel button is pushed but not
> sure
> if this would work.
>
> What is the standard approach to implementing this sort of thing?



禁用所有UI控件但取消按钮。在迭代之间调用Application.DoEvents(),比如说迭代。



Disable all UI controls but the cancel button. Call
Application.DoEvents() between the iterations, say ever x
iterations.



除了禁用所有UI控件之外,我不同意这一点。最好在一个单独的线程上运行迭代并测试一个标志。
Application.DoEvents()可能会引起像重入一样的肮脏。对我来说,Application.DoEvents()基本上是对VB没有
正确的回归。长时间穿线,几乎在所有情况下都应避免使用。

UI应保持响应,保持其消息泵线程空闲的时间尽可能多可能。

- Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet
如果回复该群组,请不要给我发邮件



I disagree with this, apart from disabling all UI controls. It is
better to run the iterations on a separate thread and test for a flag.
Application.DoEvents() can cause nastiness like re-entrancy. To my
mind, Application.DoEvents() is basically a throw-back to VB not having
"proper" threading for a long time, and should be avoided in almost all
situations.

UIs should be kept responsive by keeping their message pump threads
idle for as much of the time as possible.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too



这篇关于打破批量测试......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆