- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在读取 SSD,请求 20 个异步作业。 io_getevents 返回值 7 表示超时。超时设置为 10 秒,如下所示。调用的耗时实际上是 4.89e-05 秒,例如,几乎还剩下 10 秒。问题:有人遇到过这样的事件吗?如果找到了,那么您找到解决方案了吗?
部分代码如下:
struct timespec ts = { 10, 0 } ; /* ten seconds delay */
const long ec = io_getevents( ctx, num_jobs, num_jobs, &events[ 0 ], &ts ) ;
当ec返回7时,ts.tv_sec = 10
, ts.tv_nsec = 0
Linux 内核:
Linux VTL80-G-1J4-823-21 2.6.18-274.18.1.el5 #1 SMP Thu Feb 9 12:20:03 EST 2012 x86_64 x86_64 x86_64 GNU/Linux
非常感谢您的帮助!顺便提一句。几个小时后我将无法查看帖子。
最佳答案
通过额外的步骤和调试输出,我们发现我们的 linux 上的 aio 驱动程序存在问题(5.3 Carthage,2.6.18-128.el5)
我们应用的解决方案(我把它放在以防万一有人遇到同样的问题)是这样的:
(我们自己计算调用经过的秒数。)
1) 如果我们看到从 io_getevents()
返回的错误,我们会报告它。完成。
2) 如果我们看到 0 个作业完成并且经过的秒数我们自己计算超过预期的秒数,我们报告错误。完毕。否则我们继续(我们不更改 io_getevents()
的超时)
3) 如果某些作业已完成,我们会分析它们的 res
是否有错误(负值),如果有任何失败的作业,我们会报告它。完成。
4) 如果还有一些剩余的工作,我们重置计时器(是的,我们将再次等待“预期”时间)并继续。
使用此方法,如果 io_getevents()
报告错误或任何作业报告错误,我们将报告错误。在最坏的情况下,当每个作业在整个 T-epsilon 等待时间后返回 ok 时,整个过程将花费 N * T 时间完成。
我希望有人会发现它有用。
祝福,
格雷格。
例子:
struct timespec tmCountStart ;
unsigned seconds_delay = SECONDS_DELAY ;
clock_gettime( CLOCK_REALTIME, &tmCountStart ) ;
while ( num_remaining_jobs > 0 )
{
struct timespec ts = { seconds_delay, 0 } ;
struct io_event events[ num_remaining_jobs ] ;
long ec ;
do
{
ec = io_getevents( ctx, num_remaining_jobs, num_remaining_jobs, &events[ 0 ], &ts ) ;
}
while( ec == -EINTR ) ;
if ( ec < 0 )
throw exception reporting error ec. cancel all remaining jobs
else if ( ec == 0 )
{
const double elapsed = count elapsed seconds from tmCountStart
seconds_delay = SECONDS_DELAY - static_cast< unsigned >( elapsed ) ;
if ( seconds_delay > SECONDS_DELAY )
throw exception reporting timeout. cancel all remaining jobs
}
else // we got some jobs back. may not all of them
{
for ( int i = 0 ; i < ec ; i++ )
if (( int64_t )events[ i ].res < 0 )
throw exception reporting failing job. cancel all remaining jobs.
num_remaining_jobs -= ec ;
if ( num_remaining_jobs > 0 )
{
clock_gettime( CLOCK_REALTIME, &tmCountStart ) ; // reset timer.
seconds_delay = SECONDS_DELAY ;
}
}
}
关于c++ - io_getevents 在短于超时的时间内返回的作业数量少于请求的数量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16114435/
我希望使用 API 根据处理 Q 的大小更改运行的 Web 作业实例的数量,我知道我可以在门户中设置规则,但最短聚合时间为 60 分钟,并且我如果我们突然遇到大量工作,不希望系统在扩展之前等待 60
假设我有一个 spark 应用程序并且有两个操作导致两个 spark 作业。 //spark Application //Spark Job1 .... erro
大家好! 作为我对Java的自学的一部分,我正在尝试完成可用的Java初学者分配之一here(非常古老的东西-2001) 问题是我不知道如何应对这个挑战:(我将不胜感激任何建议,因为该解决方案不再可用
我一直在使用 HADOOP 1.2.1 服务器,并在那里执行许多 pig 作业。最近,我考虑将我的 Hadoop 服务器更改为 HADOOP 2.2.0。所以我在 HADOOP 2.2.0 中尝试了一
好的,我修复了静态错误。现在我只是想找出为什么每个对象都得到相同的条目(即相同的名字、年龄、体重等)。这是代码: package classlab3b; import classlab3B.BodyM
我的家庭作业中的一个问题需要一些帮助,我已经尝试了大约一个小时,但无法运行。 列出购买商品数量超过每位顾客平均商品数量的顾客 表格如下: Customer(Cnum, CustomerName, Ad
Kubernetes Jobs重复创建 Pod,直到指定数量的容器成功终止。作业通常与更高级别的CronJob机制一起使用,该机制会按循环计划自动启动新作业。 定期使用 Jobs 和 CronJobs
我有以下工作类(我已经删除了实际的工作代码): @On("0 0 1 * * ?") public class DailyJob extends Job { @Override pub
假设您将 cron 作业配置为每分钟运行一次以做某事。如果实际任务运行时间超过一分钟会发生什么? cron 会创建另一个作业实例/线程吗?还是 cron 会等待并确保上一次运行完成? 谢谢! 最佳答案
我们正在使用 TeamCity 7 并想知道是否可以仅在前一个步骤失败时才运行步骤?我们在构建步骤配置中的选项让您可以选择仅在所有步骤都成功时执行,即使步骤失败,或者始终运行它。 有没有办法仅在前一个
我在 oracle 中编写作业以执行存储过程,但是当时机成熟时,它不会无缘无故地发生任何事情。 是否有某种日志可以让我查看是否发生了错误或其他事情? 我使用 dbms_job 包来创建作业 恩克斯。
我正在用 Java 创建一个用于文件共享的 p2p 应用程序。每个对等节点都将在我的机器上的不同端口上运行并监听请求。但我遇到的问题是,当创建 PeerNode 实例时,我的代码会进入无限循环。以下是
我正在尝试创建一个队列,但当我运行 php artisanqueue:work 时它不起作用,我在终端中得到的只是 [2017-11-30 19:56:27] Processing: App\Jobs
我正在使用PHP库phpseclib0.2.2将SSH自动化到我的一台服务器中。我将其设置为每5分钟运行一次的cron任务。 在设置完它并确保其运行等情况下注销后,我看到了以下内容: $ logout
有没有办法获取多分支管道作业扫描收集到的所有分支的名称? 我想设置一个依赖于现有构建作业的夜间构建,因此需要检查多分支作业是否包含某些特定分支。另一种方法是检查现有作业。 最佳答案 我通过使用 Jen
我在编程方面还很陌生,我不太确定如何完成分配给我的学校作业。 Write a function void print_min(unsigned char a, short b,int c),which
我的作业有问题,需要帮助! 问题 1: 完成下面的 Java 方法,以便 raiseToPower(x,n) 将数字 x 提高到整数 n 次方(即计算值 xn )。请记住 x-n = 1/xn,x0
我正在做一项家庭作业,该作业有四个文本字段和一个文本区域,以及一个将文本字段和文本区域保存到文本文件的按钮,每行一个元素。然后,应出现一个对话框通知用户文件已保存。当对话框关闭时,它应该清空文本字段和
我需要运行一个名为ArrayHolder的java程序,它将运行两个线程。 ArrayHolder 将有一个 Array。 ThreadSeven 会用 7 覆盖该 Array 的每个元素,并用 1
在我的程序中,应该读取学生姓名、ID 号和 GPA,将其分配给指定的学生,然后打印出来。一切都编译正常,但出现错误 Error: Could not find or load main class L
我是一名优秀的程序员,十分优秀!