Skip to contentSkip to conversation

perfc: Print a system time in a convenient format

PATCH NAK Andrii Anisov 5 participants 21 messages Sep 11, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perfc: Print a system time in a convenient format

From: Andrii Anisov <[email protected]>

---
 xen/common/perfc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
xen/common/perfc.c +1 -2
index 0675677..0abd977 100644
@@ -33,8 +33,7 @@ void perfc_printall(unsigned char key)
     unsigned int i, j;
     s_time_t now = NOW();
 
-    printk("Xen performance counters SHOW  (now = 0x%08X:%08X)\n",
-           (u32)(now>>32), (u32)now);
+    printk("Xen performance counters SHOW  (now = %"PRI_stime")\n", now);
 
     for ( i = j = 0; i < NR_PERFCTRS; i++ )
     {
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

xen/common/perfc.c void perfc_printall(unsigned char key) · line 36

Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 11.09.18 at 08:53, <[email protected]> wrote:
xen/common/perfc.c +1 -2
@@ -33,8 +33,7 @@ void perfc_printall(unsigned char key)
     unsigned int i, j;
     s_time_t now = NOW();
 
-    printk("Xen performance counters SHOW  (now = 0x%08X:%08X)\n",
-           (u32)(now>>32), (u32)now);
+    printk("Xen performance counters SHOW  (now = %"PRI_stime")\n", now);

NAK, for two reasons: I'm not of the opinion that reading a 15 or more digit decimal number without any separators is any easier than the current format. And then if you/we were to change this, then please uniformly everywhere - there's even a second instance right in this same file you change, not to speak of similar ones elsewhere.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw

Hello Jan,

Quoted 3 lines · Jan Beulich

NAK, for two reasons: I'm not of the opinion that reading a 15 or more digit decimal number without any separators is any easier than the current format.

It's quite subjective. IMHO timestamps measured in ns easier to understand in decimals rather than in separated 32-bit hex-es. No matter how many digital number they have. Even post processing of perfc output is easier in case of decimal timestamps. You should not parse hexes and odd separators to calculate the time elapsed between two samples.

Quoted 3 lines

And then if you/we were to change this, then please
uniformly everywhere - there's even a second instance right in this same file you change, not to speak of similar ones elsewhere

I'll check through this file.

Signature · 8 lines
*Andrii Anisov*



_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#3 lore raw
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 11.09.18 at 10:50, <[email protected]> wrote:
Quoted 3 lines · Jan Beulich

NAK, for two reasons: I'm not of the opinion that reading a 15 or more digit decimal number without any separators is any easier than the current format.

It's quite subjective. IMHO timestamps measured in ns easier to understand in decimals rather than in separated 32-bit hex-es. No matter how many digital number they have.

It is subjective, yes, but in such a case you even more so need to demonstrate a change is an overall improvement.

Quoted 3 lines

Even post processing of perfc output is easier in case of decimal timestamps. You should not parse hexes and odd separators to calculate the time elapsed between two samples.

Post processing usually uses scrips for parsing - I don't think it's overly complicated to have a script convert the number into basically any format you want.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw
Quoted 11 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 11.09.18 at 10:50, <[email protected]> wrote:
Quoted 3 lines · Jan Beulich

NAK, for two reasons: I'm not of the opinion that reading a 15 or more digit decimal number without any separators is any easier than the current format.

It's quite subjective. IMHO timestamps measured in ns easier to understand in decimals rather than in separated 32-bit hex-es. No matter how many digital number they have.

It is subjective, yes, but in such a case you even more so need to demonstrate a change is an overall improvement.

Quoted 6 lines
Quoted 3 lines

Even post processing of perfc output is easier in case of decimal timestamps. You should not parse hexes and odd separators to calculate the time elapsed between two samples.

Post processing usually uses scrips for parsing - I don't think it's overly complicated to have a script convert the number into basically any format you want.

Right, but this particular mis-pattern wants fixing.  It is simply confusing to have a single number formatted with a colon inbetween.

andrewcoop@andrewcoop:/local/xen.git/xen$ git grep -i "now>>32"
arch/x86/numa.c:381:           (u32)(now>>32), (u32)now);
common/keyhandler.c:258:           (u32)(now>>32), (u32)now);
common/page_alloc.c:2424:           (u32)(now>>32), (u32)now);
common/perfc.c:37:           (u32)(now>>32), (u32)now);
common/perfc.c:126:               (u32)(now>>32), (u32)now);
common/spinlock.c:363:        "total = %08X:%08X)\n", (u32)(now>>32),
(u32)now,
common/spinlock.c:383:            (u32)(now>>32), (u32)now);

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#5 lore raw
Quoted 16 lines
Quoted 1 line
Quoted 1 line · On 11.09.18 at 11:15, <[email protected]> wrote:
Quoted 14 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 11.09.18 at 10:50, <[email protected]> wrote:
Quoted 3 lines · Jan Beulich

NAK, for two reasons: I'm not of the opinion that reading a 15 or more digit decimal number without any separators is any easier than the current format.

It's quite subjective. IMHO timestamps measured in ns easier to understand in decimals rather than in separated 32-bit hex-es. No matter how many digital number they have.

It is subjective, yes, but in such a case you even more so need to demonstrate a change is an overall improvement.

Quoted 3 lines

Even post processing of perfc output is easier in case of decimal timestamps. You should not parse hexes and odd separators to calculate the time elapsed between two samples.

Quoted 6 lines
Quoted 3 lines

Post processing usually uses scrips for parsing - I don't think it's overly complicated to have a script convert the number into basically any format you want.

Right, but this particular mis-pattern wants fixing. It is simply confusing to have a single number formatted with a colon inbetween.

What other separator do you suggest? I consider it quite helpful to have one when there are more than about 10 digits. (I'd also be fine, btw, to have the time printed in decimal, but then perhaps with ms granularity and 6 digits for the fractional part.)

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#6 lore raw
Quoted 19 lines · Jan Beulich
Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 11.09.18 at 11:15, <[email protected]> wrote:
Quoted 17 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 11.09.18 at 10:50, <[email protected]> wrote:
Quoted 3 lines · Jan Beulich

NAK, for two reasons: I'm not of the opinion that reading a 15 or more digit decimal number without any separators is any easier than the current format.

It's quite subjective. IMHO timestamps measured in ns easier to understand in decimals rather than in separated 32-bit hex-es. No matter how many digital number they have.

It is subjective, yes, but in such a case you even more so need to demonstrate a change is an overall improvement.

Quoted 3 lines

Even post processing of perfc output is easier in case of decimal timestamps. You should not parse hexes and odd separators to calculate the time elapsed between two samples.

Post processing usually uses scrips for parsing - I don't think it's overly complicated to have a script convert the number into basically any format you want.

Quoted 6 lines
Quoted 2 lines

Right, but this particular mis-pattern wants fixing. It is simply confusing to have a single number formatted with a colon inbetween.

What other separator do you suggest? I consider it quite helpful to have one when there are more than about 10 digits. (I'd also be fine, btw, to have the time printed in decimal, but then perhaps with ms granularity and 6 digits for the fractional part.)

It is currently more common across the base to use the format proposed by Andrii.

For consistently alone, that format should be followed, or *everything* should be changed.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#7 lore raw
Quoted 28 lines
Quoted 1 line
Quoted 1 line · On 11.09.18 at 11:20, <[email protected]> wrote:
Quoted 19 lines · Jan Beulich
Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 11.09.18 at 11:15, <[email protected]> wrote:
Quoted 17 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 11.09.18 at 10:50, <[email protected]> wrote:
Quoted 3 lines · Jan Beulich

NAK, for two reasons: I'm not of the opinion that reading a 15 or more digit decimal number without any separators is any easier than the current format.

It's quite subjective. IMHO timestamps measured in ns easier to understand in decimals rather than in separated 32-bit hex-es. No matter how many digital number they have.

It is subjective, yes, but in such a case you even more so need to demonstrate a change is an overall improvement.

Quoted 3 lines

Even post processing of perfc output is easier in case of decimal timestamps. You should not parse hexes and odd separators to calculate the time elapsed between two samples.

Post processing usually uses scrips for parsing - I don't think it's overly complicated to have a script convert the number into basically any format you want.

Quoted 6 lines
Quoted 2 lines

Right, but this particular mis-pattern wants fixing. It is simply confusing to have a single number formatted with a colon inbetween.

What other separator do you suggest? I consider it quite helpful to have one when there are more than about 10 digits. (I'd also be fine, btw, to have the time printed in decimal, but then perhaps with ms granularity and 6 digits for the fractional part.)

Quoted 5 lines

It is currently more common across the base to use the format proposed by Andrii.

For consistently alone, that format should be followed, or *everything* should be changed.

_More_ consistency would be desirable, but I don't think there's a strict need to get there in one step. A patch shouldn't result in less consistency, I fully agree. If there are other hard to parse (by a human) time stamps which get logged, I'm all for changing them, but right here the focus is just on the headlines which some of the key handlers log (which, as indicated before, I'd indeed like to see changed all in one go).

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#8 lore raw
In reply to Jan Beulich
Quoted 4 lines · Jan Beulich

What other separator do you suggest? I consider it quite helpful to have one when there are more than about 10 digits. (I'd also be fine, btw, to have the time printed in decimal, but then perhaps with ms granularity and 6 digits for the fractional part.)

Should we think about replacing PRI_stime?

Signature · 8 lines
*Andrii Anisov*



_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#9 lore raw
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 11.09.18 at 11:21, <[email protected]> wrote:
Quoted 4 lines · Jan Beulich

What other separator do you suggest? I consider it quite helpful to have one when there are more than about 10 digits. (I'd also be fine, btw, to have the time printed in decimal, but then perhaps with ms granularity and 6 digits for the fractional part.)

Should we think about replacing PRI_stime?

Why not, but that would require adding another %p suffix or introducing a construct splitting s_time_t values into two pieces (to be used to hide the two printk() arguments required).

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#10 lore raw
Quoted 4 lines · Jan Beulich
Quoted 1 line

Should we think about replacing PRI_stime?

Why not, but that would require adding another %p suffix or introducing a construct splitting s_time_t values into two pieces (to be used to hide the two printk() arguments required).

I don't think that splitting s_time_i is reasonable. Introducing %pt for ns granularity and %pT for ms could be an option.

Signature · 8 lines
*Andrii Anisov*



_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#11 lore raw

So what would be the conclusion?

I'm going to change timestamps format to decimal for all keyhandlers. But what about the format itself? Does existing plain ns PRI_stime have a chance to be acked?

Or should I think of an extended format (seconds with fractions, ms with fractions)?

Quoted 9 lines · Andrii Anisov
Quoted 4 lines · Jan Beulich
Quoted 1 line

Should we think about replacing PRI_stime?

Why not, but that would require adding another %p suffix or introducing a construct splitting s_time_t values into two pieces (to be used to hide the two printk() arguments required).

I don't think that splitting s_time_i is reasonable. Introducing %pt for ns granularity and %pT for ms could be an option.

Signature · 8 lines
*Andrii Anisov*



_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#12 lore raw
Quoted 8 lines · Andrii Anisov

So what would be the conclusion?

I'm going to change timestamps format to decimal for all keyhandlers. But what about the format itself? Does existing plain ns PRI_stime have a chance to be acked?

Or should I think of an extended format (seconds with fractions, ms with fractions)?

I am happy with the current PRI_stime. If you sent such a patch I would Ack it and argue for it to be accepted. (Whether I would prevail, of course, is a different question.)

I think it would be great to have an extended format for time that printed <seconds>.<nanoseconds>, and would be very happy if you decided you wanted to do that. But I don't think you should be required to do it.

-George

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#13 lore raw
In reply to Andrii Anisov
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 11.09.18 at 16:04, <[email protected]> wrote:

So what would be the conclusion?

I'm going to change timestamps format to decimal for all keyhandlers. But what about the format itself? Does existing plain ns PRI_stime have a chance to be acked?

Well, if everyone else thinks this is a good idea, then I'm sure someone will ack it (and I certainly wouldn't veto it in such a case).

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#14 lore raw
In reply to Jan Beulich
Quoted 20 lines · Jan Beulich
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 11.09.18 at 11:15, <[email protected]> wrote:
Quoted 17 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 11.09.18 at 10:50, <[email protected]> wrote:
Quoted 3 lines · Jan Beulich

NAK, for two reasons: I'm not of the opinion that reading a 15 or more digit decimal number without any separators is any easier than the current format.

It's quite subjective. IMHO timestamps measured in ns easier to understand in decimals rather than in separated 32-bit hex-es. No matter how many digital number they have.

It is subjective, yes, but in such a case you even more so need to demonstrate a change is an overall improvement.

Quoted 3 lines

Even post processing of perfc output is easier in case of decimal timestamps. You should not parse hexes and odd separators to calculate the time elapsed between two samples.

Post processing usually uses scrips for parsing - I don't think it's overly complicated to have a script convert the number into basically any format you want.

Quoted 7 lines
Quoted 2 lines

Right, but this particular mis-pattern wants fixing. It is simply confusing to have a single number formatted with a colon inbetween.

What other separator do you suggest? I consider it quite helpful to have one when there are more than about 10 digits. (I'd also be fine, btw, to have the time printed in decimal, but then perhaps with ms granularity and 6 digits for the fractional part.)

* We clearly already have a standard way of printing stime
* The places where a colon is used are non-standard, and thus wrong
* His patch makes an improvement by fixing the non-standard timestamp printing.

If you're not happy with the current PRI_stime, then it should be on you to propose and code up a change, not Andrii (unless he feels particularly motivated to do so).

-George

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#15 lore raw
Quoted 30 lines
Quoted 1 line
Quoted 1 line · On 11.09.18 at 11:28, <[email protected]> wrote:
Quoted 20 lines · Jan Beulich
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 11.09.18 at 11:15, <[email protected]> wrote:
Quoted 17 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 11.09.18 at 10:50, <[email protected]> wrote:
Quoted 3 lines · Jan Beulich

NAK, for two reasons: I'm not of the opinion that reading a 15 or more digit decimal number without any separators is any easier than the current format.

It's quite subjective. IMHO timestamps measured in ns easier to understand in decimals rather than in separated 32-bit hex-es. No matter how many digital number they have.

It is subjective, yes, but in such a case you even more so need to demonstrate a change is an overall improvement.

Quoted 3 lines

Even post processing of perfc output is easier in case of decimal timestamps. You should not parse hexes and odd separators to calculate the time elapsed between two samples.

Post processing usually uses scrips for parsing - I don't think it's overly complicated to have a script convert the number into basically any format you want.

Quoted 7 lines
Quoted 2 lines

Right, but this particular mis-pattern wants fixing. It is simply confusing to have a single number formatted with a colon inbetween.

What other separator do you suggest? I consider it quite helpful to have one when there are more than about 10 digits. (I'd also be fine, btw, to have the time printed in decimal, but then perhaps with ms granularity and 6 digits for the fractional part.)

Quoted 8 lines

* We clearly already have a standard way of printing stime
* The places where a colon is used are non-standard, and thus wrong
* His patch makes an improvement by fixing the non-standard timestamp printing.

If you're not happy with the current PRI_stime, then it should be on you to propose and code up a change, not Andrii (unless he feels particularly motivated to do so).

Excuse me, but no. I'm sure there are places where PRI_stime is fine to use as is, or there are people thinking so. But to me personally the proposed change is the opposite of an improvement, and hence I think I'm perfectly fine to object without going and creating a counter proposal patch myself. If I'm the only one, I can still be talked into accepting the change, or outvoted.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#16 lore raw
In reply to Jan Beulich
Quoted 2 lines · Jan Beulich

It is subjective, yes, but in such a case you even more so need to demonstrate a change is an overall improvement.

I would phrase it as "printing timestapms in timestamp format".

Signature · 7 lines
*Andrii Anisov*


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#17 lore raw
In reply to Andrii Anisov
Quoted 7 lines · Andrii Anisov

Hello Jan,

Quoted 3 lines · Jan Beulich

NAK, for two reasons: I'm not of the opinion that reading a 15 or more digit decimal number without any separators is any easier than the current format.

Quoted 6 lines

It's quite subjective. IMHO timestamps measured in ns easier to understand in decimals rather than in separated 32-bit hex-es. No matter how many digital number they have.
Even post processing of perfc output is easier in case of decimal timestamps. You should not parse hexes and odd separators to calculate the time elapsed between two samples.

I agree with this. Printing in hexadecimal is useful if you need to see the bitwise structure of the content; that's of zero use when it comes to timestamps. On the contrary, you almost always want to be able to do a subtraction in your head and get at least an order-of-magnitude difference between the times, something which is far too difficult in hex.

The fact that we even have PRI_stime is evidence that the developer community as a whole agrees.

Quoted 3 lines
Quoted 3 lines

  And then if you/we were to change this, then please uniformly everywhere - there's even a second instance right in this same file you change, not to speak of similar ones elsewhere

Presumably the fact that we have PRI_stime defined means that *most* places already use this format, and the places with : in the middle are outliers. It's perfectly acceptable to change them one by one; changing them all should only be a suggestion.

-George

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#18 lore raw
Quoted 16 lines
Quoted 1 line
Quoted 1 line · On 11.09.18 at 11:24, <[email protected]> wrote:
Quoted 7 lines · Andrii Anisov

Hello Jan,

Quoted 3 lines · Jan Beulich

NAK, for two reasons: I'm not of the opinion that reading a 15 or more digit decimal number without any separators is any easier than the current format.

Quoted 6 lines

It's quite subjective. IMHO timestamps measured in ns easier to understand in decimals rather than in separated 32-bit hex-es. No matter how many digital number they have.
Even post processing of perfc output is easier in case of decimal timestamps. You should not parse hexes and odd separators to calculate the time elapsed between two samples.

Quoted 5 lines

I agree with this. Printing in hexadecimal is useful if you need to see the bitwise structure of the content; that's of zero use when it comes to timestamps. On the contrary, you almost always want to be able to do a subtraction in your head and get at least an order-of-magnitude difference between the times, something which is far too difficult in hex.

I disagree - it's a matter of who looks at those numbers. Personally I'm quite fine doing order-of-magnitude hex math.

Quoted 11 lines

The fact that we even have PRI_stime is evidence that the developer community as a whole agrees.

Quoted 3 lines
Quoted 3 lines

And then if you/we were to change this, then please
uniformly everywhere - there's even a second instance right in this same file you change, not to speak of similar ones elsewhere

Presumably the fact that we have PRI_stime defined means that *most* places already use this format, and the places with : in the middle are outliers. It's perfectly acceptable to change them one by one; changing them all should only be a suggestion.

Well, what should I say - I disagree. I would agree if it would be a whole lot of work, but there's not that many key handlers to begin with, and far not all of them print a time stamp in their headlines.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#19 lore raw
Quoted 3 lines · Jan Beulich

Well, what should I say - I disagree. I would agree if it would be a whole lot of work, but there's not that many key handlers to begin with, and far not all of them print a time stamp in their headlines.

I'm quite ok with that.

Signature · 8 lines
*Andrii Anisov*



_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#20 lore raw
In reply to Jan Beulich
Quoted 16 lines · Jan Beulich
Quoted 16 lines
Quoted 1 line
Quoted 1 line · On 11.09.18 at 11:24, <[email protected]> wrote:
Quoted 13 lines · Andrii Anisov

Hello Jan,

Quoted 3 lines · Jan Beulich

NAK, for two reasons: I'm not of the opinion that reading a 15 or more digit decimal number without any separators is any easier than the current format.

It's quite subjective. IMHO timestamps measured in ns easier to understand in decimals rather than in separated 32-bit hex-es. No matter how many digital number they have.
Even post processing of perfc output is easier in case of decimal timestamps. You should not parse hexes and odd separators to calculate the time elapsed between two samples.

Quoted 8 lines
Quoted 5 lines

I agree with this. Printing in hexadecimal is useful if you need to see the bitwise structure of the content; that's of zero use when it comes to timestamps. On the contrary, you almost always want to be able to do a subtraction in your head and get at least an order-of-magnitude difference between the times, something which is far too difficult in hex.

I disagree - it's a matter of who looks at those numbers. Personally I'm quite fine doing order-of-magnitude hex math.

So quick, about how long is 0x10:00000000 ns?

Maybe you know how long that is, but I would posit that if so, you are among a handful of people worldwide who have happened to train yourself in that knowledge. The millions of Xen developers and system administrators worldwide who don't have that sense, and (like me) have absolutely no interest in gaining that knowledge. I have much better things to do with my time.

Changing it to seconds (i.e., using the decimal point as a "separator") would make sense, and I'd be in favor of a patch which did something to that effect. But PRI_stime is still an improvement (for the vast majority of our users and developers); we shouldn't let the best become the enemy of the good.

-George

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel