Revision 07de3e60 monitor.c
b/monitor.c | ||
---|---|---|
83 | 83 |
* suffix, which multiplies the value by 2^40 for |
84 | 84 |
* suffixes T and t, 2^30 for suffixes G and g, 2^20 for |
85 | 85 |
* M and m, 2^10 for K and k |
86 |
* 'f' double |
|
87 |
* user mode accepts an optional G, g, M, m, K, k suffix, |
|
88 |
* which multiplies the value by 2^30 for suffixes G and |
|
89 |
* g, 2^20 for M and m, 2^10 for K and k |
|
90 | 86 |
* 'T' double |
91 | 87 |
* user mode accepts an optional ms, us, ns suffix, |
92 | 88 |
* which divides the value by 1e3, 1e6, 1e9, respectively |
... | ... | |
3731 | 3727 |
p = end; |
3732 | 3728 |
} |
3733 | 3729 |
break; |
3734 |
case 'f': |
|
3735 | 3730 |
case 'T': |
3736 | 3731 |
{ |
3737 | 3732 |
double val; |
... | ... | |
3747 | 3742 |
if (get_double(mon, &val, &p) < 0) { |
3748 | 3743 |
goto fail; |
3749 | 3744 |
} |
3750 |
if (c == 'f' && *p) { |
|
3751 |
switch (*p) { |
|
3752 |
case 'K': case 'k': |
|
3753 |
val *= 1 << 10; p++; break; |
|
3754 |
case 'M': case 'm': |
|
3755 |
val *= 1 << 20; p++; break; |
|
3756 |
case 'G': case 'g': |
|
3757 |
val *= 1 << 30; p++; break; |
|
3758 |
} |
|
3759 |
} |
|
3760 |
if (c == 'T' && p[0] && p[1] == 's') { |
|
3745 |
if (p[0] && p[1] == 's') { |
|
3761 | 3746 |
switch (*p) { |
3762 | 3747 |
case 'm': |
3763 | 3748 |
val /= 1e3; p += 2; break; |
... | ... | |
4240 | 4225 |
return -1; |
4241 | 4226 |
} |
4242 | 4227 |
break; |
4243 |
case 'f': |
|
4244 | 4228 |
case 'T': |
4245 | 4229 |
if (qobject_type(client_arg) != QTYPE_QINT && |
4246 | 4230 |
qobject_type(client_arg) != QTYPE_QFLOAT) { |
Also available in: Unified diff