Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1441 - Add Time in Place to Transform History #668

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Kevinnnnnnnnnnnnnnnn
Copy link
Collaborator

@Kevinnnnnnnnnnnnnnnn Kevinnnnnnnnnnnnnnnn commented Jan 31, 2024

First working draft, no logic as of yet to enable/disable.

@fbruton
Copy link
Collaborator

fbruton commented Feb 1, 2024

I ran across the post about configuring performance metrics.

https://stackoverflow.com/questions/34911347/system-nanotime-for-calculating-execution-time-and-performance-impact

private static final boolean ADD_TIME_IN_PLACE_TO_TRANSFORM_HISTORY = true; // change to false while development

public static long nanoTime() {
    return ADD_TIME_IN_PLACE_TO_TRANSFORM_HISTORY ? System.nanoTime() : 0;
}

@Kevinnnnnnnnnnnnnnnn
Copy link
Collaborator Author

I ran across the post about configuring performance metrics.

https://stackoverflow.com/questions/34911347/system-nanotime-for-calculating-execution-time-and-performance-impact

private static final boolean ADD_TIME_IN_PLACE_TO_TRANSFORM_HISTORY = true; // change to false while development

public static long nanoTime() {
    return ADD_TIME_IN_PLACE_TO_TRANSFORM_HISTORY ? System.nanoTime() : 0;
}

Oh yeah, that's not a bad way to do it! Did you read the other post on that thread though about the cost of calling System.nanoTime() versus the cost of concatenating a number to a string and performing I/O operations? I thought that was interesting.

Also, my next hurdle is figuring out a good way to let the user turn timing on and off. An environment variable seems like the obvious solution so that it could be turned on and off without having to restart the server or anything.

@cfkoehler cfkoehler added the feature A new feature that does not exist today label Feb 9, 2024
Copy link
Collaborator

@drivenflywheel drivenflywheel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good starting point. Definitely needs support for toggling on/off.

sb.append(" ");
if (h.wasCoordinated()) {
sb.append(" ");
}
// check is NO_URL or not
sb.append(" ").append(historyCase.equals(NO_URL) ? h.getKeyNoUrl() : h.getKey()).append("\n");
sb.append(" ").append(historyCase.equals(NO_URL) ? h.getKeyNoUrl() : h.getKey()).append(" Time: ")
.append(msInPlace).append("ms")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll probably want to specify a format for the raw msInPlace value to constrain the number of decimal places. I'm seeing values such as these, and those last digits are insignificant:

1.295251ms
1.370848ms
79.253002ms
0.338698ms
0.540692ms
4.128181ms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature that does not exist today
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants