- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
在 linux shell 脚本中,我正在针对对 REST 服务的 curl 请求运行时间。
假设一个线程,如果我获取结果的实时时间并减去用户和系统时间,剩余时间是否会被视为网络延迟和服务完成请求所需时间的总和?
如果没有,是否有一种简单的方法来获取网络延迟和服务完成 linux shell 请求所需的时间?
引用:What do 'real', 'user' and 'sys' mean in the output of time(1)?
最佳答案
如果您使用的是 curl
,获取请求计时详细信息的最简单方法是使用 -w
/--write-out
选项。
您可以格式化输出以包含如下变量:
time_appconnect
The time, in seconds, it took from the start until the SSL/SSH/etc connect/handshake to the remote host was completed. (Added in 7.19.0)
time_connect
The time, in seconds, it took from the start until the TCP connect to the remote host (or proxy) was completed.
time_namelookup
The time, in seconds, it took from the start until the name resolving was completed.
time_pretransfer
The time, in seconds, it took from the start until the file transfer was just about to begin. This includes all pre-transfer commands and negotiations that are specific to the particular protocol(s) involved.
time_redirect
The time, in seconds, it took for all redirection steps include name lookup, connect, pretransfer and transfer before the final transaction was started. time_redirect shows the complete execution time for multiple redirections. (Added in 7.12.3)
time_starttransfer
The time, in seconds, it took from the start until the first byte was just about to be transferred. This includes time_pretransfer and also the time the server needed to calculate the result.
time_total
The total time, in seconds, that the full operation lasted. The time will be displayed with millisecond resolution.
例如:
$ curl httpbin.org/ip -s -o output -w 'dns: %{time_namelookup} sec\nconnect: %{time_connect} sec\nuntil first byte: %{time_starttransfer} sec\ntotal: %{time_total} sec\n'
dns: 0.061 sec
connect: 0.297 sec
until first byte: 0.502 sec
total: 0.502 sec
回答您的直接问题 - 不,从挂钟时间减去进程和进程内核时间通常不会给您网络延迟或响应时间。考虑具有许多进程竞争 CPU 的系统:在这种情况下,您的 curl
进程的挂钟可能比实际服务响应时间长得多。
关于linux - 我可以使用 curl real time 减去 sys 和 user 来获得总响应时间吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45763622/
我在决定是将我的应用程序归类为“实时”还是“接近实时”,或者甚至是其他类别时遇到了麻烦。 该软件会立即接收从源生成的数据,然后根据某些规则,在满足某些条件时发出警报。它采用每 30 秒检查一次最近 3
我的 c 编译器有问题当编译一个简单的hello world时,用户时间是>>>实时的。 这里是两台机器之间的时间比较。 需要注意的是,机器没有执行任何其他任务,其他操作运行得很快(甚至是其他编译器)
虽然我用 C 实现了很多项目,但我对操作系统完全陌生。我在探索板 (STM32) 上尝试了实时 linux,并得到了 LED 闪烁的正确结果,但我并没有真正理解整个过程,因为我只是按照步骤操作,无法在
我的问题是,“可以使用 select type block 来区分 real::realInput 和 real::realArrayInput(:) ?”很清楚 select type 可以如何用于
通过 fortran-iso-c-binding,我可以连接 C 函数并获取类似类型的变量 real(c_float) integer(c_int) 但在程序的其余部分我想使用基本类型(仅仅是因为我不
我正在编写一个应用程序,在某个 block 中我需要对实数取幂大约 3*500*500 次。当我使用 exp(y*log(x)) 算法时,程序明显滞后。如果我使用另一种基于处理数据类型的算法,速度会快
我目前在 science linux 6 下使用 gfortran 4.4.7 编译器。我需要用 128 位声明变量。我无法更改操作系统希望在science linux 6下能做一些事情。 最佳答案
当我在 .NET 中将进程的优先级设置为实时时: Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime;
我正在使用 Accelerate Framework 在 iOS 中实现基于加速度计的 FFT,但我仍然有点困惑的是这一部分: /* The output signal is now in a spl
用 f(x::Real) 定义函数有什么区别吗?和 f{T <: Real}(x::T) ? @code_warntype给出相同的输出 function f(x::Real) x^2 end
所以我看到了these two questions on twitter . 1.real 是语法错误,而 1 .real 不是? >>> 1.real File "", line 1 1
我有这个简单的代码,它使用 DGEMM 例程进行矩阵乘法 program check implicit none real(8),dimension(2,2)::A,B,C A(1,1)=
如标题所示,我使用了 Media Foundation WavSink 示例,该示例将音频流解码为 PCM 并转储到文件。 我的应用程序是将此流定向到 FMOD 音频引擎,该引擎以实时速率使用 PCM
1) 独占时间是在方法中花费的时间2) 包含时间是在方法中花费的时间加上在任何被调用函数中花费的时间3)我们称调用方法为“ parent ”,称方法为“子”。引用链接:Click here 这里的问题
我正在尝试使用 PS3 Eye 实时执行到达时间差。由于它内置了4个麦克风阵列,我成功地将阵列重新排列成方形阵列,并使用MATLAB对信号进行互相关,得到了一个相对准确的TDOA算法。然而,到目前为止
我开始改进一些旧的 R 代码,发现下一个函数是 deprecated : real创建指定长度的 double 向量。向量的每个元素都等于 0。 as.real试图将其参数强制为 double 类型。
因此,得出以下结论:实时异常检测的定义是什么? 我正在研究异常检测领域,在许多论文中,该方法被定义为实时,而在许多其他论文中,它简称为异常检测。 我碰巧发现,纠正我是否我错了,大多数所谓的实时方法实际
查看所有现有的操作转换框架示例,它们似乎都解决了将更改转换为纯文本文档的问题。 OT 框架如何用于更复杂的对象? 我想开发一个实时便签样式的应用程序,人们可以在其中共同创建便签,更改他们的位置和文本值
Closed. This question does not meet Stack Overflow guidelines。它当前不接受答案。 想改善这个问题吗?更新问题,以使为on-topic。 4
我有大量的点数据流(二维)(每秒数千个)。在这张 map 上,我有几个固定的多边形(几十到几百个)。 我想实时确定(在相当强大的笔记本电脑上几毫秒的数量级)它所在的多边形(多边形可以相交)的每个点。我
我是一名优秀的程序员,十分优秀!