Perfmon,如何组合 FirstValueA 和 FirstValueB?
我正在使用性能监视器来收集计数器数据并将其保存到数据库中。这是msdn http://msdn.microsoft.com/en-us/library/windows/desktop/aa371915(v=VS.85).aspx
基于DB结构,这是 FirstValueA 的定义:
将此 32 位值与 FirstValueB 的值相结合以创建 PDH_RAW_COUNTER 的 FirstValue 成员。 FirstValueA 包含低 订购位。
和 FirstValueB:
将此 32 位值与 FirstValueA 的值相结合以创建 PDH_RAW_COUNTER 的 FirstValue 成员。 FirstValueB 包含高 订购位。
应组合字段 FirstValueA 和 FirstValueB 以创建 FirstValue,类似地创建 SecondValue。
如何组合 FirstValueA 和 FirstValueB 来获取 SQL Server 中的 FirstValue?
I am using performance monitor to collect the counters data and save it to the DB. Here is the DB structure defined in the msdn http://msdn.microsoft.com/en-us/library/windows/desktop/aa371915(v=VS.85).aspx
Based on DB structure, here is the definition of the FirstValueA:
Combine this 32-bit value with the value of FirstValueB to create the
FirstValue member of PDH_RAW_COUNTER. FirstValueA contains the low
order bits.
And the FirstValueB:
Combine this 32-bit value with the value of FirstValueA to create the
FirstValue member of PDH_RAW_COUNTER. FirstValueB contains the high
order bits.
The fields FirstValueA and FirstValueB should be combined to create the FirstValue, and similarly the SecondValue.
How do you combine FirstValueA and FirstValueB to get the FirstValue in SQL Server?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
所以他们说的是你需要将两者结合起来,就像这样:
它说的是我们需要将两者结合起来。它说A是低阶,B是高阶。
让我们参考维基百科的 http://en.wikipedia.org/wiki/Least_significant_bit 看看
低阶位于 -->右
,高位位于<-- 左
。所以我们最终会得到(我们之前的例子)
现在
,如果值看起来像这样,那就不起作用了:
你给出的不是两个二进制字符串,而是两个整数。因此,您必须将左侧值乘以 2**32,然后将其添加到右侧值。 (顺便说一句,这是一个 64 位字段)
让我们检查一下,为什么低位位于右侧而高位位于左侧:
二进制的书写方式就像阿拉伯数字一样。在阿拉伯数字中,数字:
表示十二万三千、四百五十六。十万是最重要的部分(因为我们会将其缩短为“刚刚超过十万美元”而不是“远超过六美元”),而六是我们最容易放弃的部分。所以我们可以说这个数字是:
123 是包含高位的值,456 是包含低位的值。在这里,我们将乘以 10^3 将它们加在一起(这是一个数学事实,而不是猜测,所以相信我),因为它看起来像这样:
所以对于二进制也同样有效:
tl;dr:
Multiply B 除以 2^32 并添加到 A
So what they're saying is that you need to comingle the two, like this:
What it says is we need to combine the two. It says that A is the low order, and B is the high order.
Let's refer to Wikipedia for http://en.wikipedia.org/wiki/Least_significant_bit and see that the
low order is on the --> right
, and thehigh order is on the <-- left
.So we're going to end up with (our previous example)
becomes
Now, that doesn't work if the values look like this:
What you're given is not two binary strings, but two integers. So you have to multiply the left value by 2**32 and add it to the right value. (that's a 64 bit field by the way)
let's examine tho, why the low order bit is on the right and the high order is on the left:
Binary is written just like Arabic numerals. In Arabic numerals, the number:
means one hundred twenty three thousand, four hundred fifty six. The one hundred thousand is the most significant part (given as we would shorten this to "just over one hundred thousand dollars" instead of "a lot over 6 dollars") and the six is the part we most freely drop. So we could say that the number were:
123 is the value that contains the high order bits, and 456 is the value that contains the low order bits. Here we would multiply by 10^3 to add them together (this is a mathematical fact, not a guess, so trust me on this) because it would look like this:
and so the same works for the binary:
tl;dr:
Multiply B by 2^32 and add to A