-
Notifications
You must be signed in to change notification settings - Fork 729
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
Clean up code for FrequentObjectsStats #20445
Clean up code for FrequentObjectsStats #20445
Conversation
@dmitripivkine please review the changes, Thanks |
a49c2f1
to
34a017a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, a few minor missed points
@@ -81,23 +81,23 @@ MM_FrequentObjectsStats::kill(MM_EnvironmentBase *env) | |||
void | |||
MM_FrequentObjectsStats::traceStats(MM_EnvironmentBase *env) | |||
{ | |||
UDATA i; | |||
uintptr_t i; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please set initial value 0
for(i=0; i < spaceSavingGetCurSize(_spaceSaving) && i < _topKFrequent; i++){ | ||
J9Class * clazz = (J9Class *) spaceSavingGetKthMostFreq(_spaceSaving,i+1); | ||
UDATA count = spaceSavingGetKthMostFreqCount(_spaceSaving,i+1); | ||
for (i=0; i < spaceSavingGetCurSize(_spaceSaving) && i < _topKFrequent; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add spaces around "="
UDATA count = spaceSavingGetKthMostFreqCount(_spaceSaving,i+1); | ||
for (i=0; i < spaceSavingGetCurSize(_spaceSaving) && i < _topKFrequent; i++) { | ||
J9Class *clazz = (J9Class *) spaceSavingGetKthMostFreq(_spaceSaving, i+1); | ||
uintptr_t count = spaceSavingGetKthMostFreqCount(_spaceSaving, i+1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add spaces around "+", here and above
@@ -106,24 +106,23 @@ MM_FrequentObjectsStats::traceStats(MM_EnvironmentBase *env) | |||
|
|||
utf = J9ROMCLASS_CLASSNAME(arrayClass->leafComponentType->romClass); | |||
Trc_MM_FrequentObjectStats_AllocationCacheIndexableObjectAllocation( | |||
vmThread, clazz, J9UTF8_LENGTH(utf), J9UTF8_DATA(utf), arity*2, brackets, count, (UDATA) (((float)count)*sampleFreq)); | |||
}else{ | |||
vmThread, clazz, J9UTF8_LENGTH(utf), J9UTF8_DATA(utf), arity*2, brackets, count, (uintptr_t) (((float)count)*sampleFreq)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spaces around *
{ | ||
UDATA i; | ||
OMRSpaceSaving* spaceSaving = frequentObjectsStats->_spaceSaving; | ||
uintptr_t i; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add initial value 0
for(i = 0; i < spaceSavingGetCurSize(spaceSaving); i++ ){ | ||
spaceSavingUpdate(_spaceSaving, spaceSavingGetKthMostFreq(spaceSaving,i+1), spaceSavingGetKthMostFreqCount(spaceSaving,i+1)); | ||
for (i = 0; i < spaceSavingGetCurSize(spaceSaving); i++) { | ||
spaceSavingUpdate(_spaceSaving, spaceSavingGetKthMostFreq(spaceSaving, i+1), spaceSavingGetKthMostFreqCount(spaceSaving, i+1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spaces around +, twice
UDATA arity = arrayClass->arity; | ||
J9UTF8* utf; | ||
uintptr_t arity = arrayClass->arity; | ||
J9UTF8 *utf; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
initial value NULL
@@ -92,15 +92,15 @@ class MM_FrequentObjectsStats : public MM_Base | |||
* @param portLibrary the port library | |||
* @param k the number of frequent objects we'd like to accurately report | |||
*/ | |||
MM_FrequentObjectsStats(J9PortLibrary *portLibrary, U_32 k=TOPK_FREQUENT_DEFAULT) | |||
MM_FrequentObjectsStats(J9PortLibrary *portLibrary, uint32_t k=TOPK_FREQUENT_DEFAULT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spaces around =
Trc_MM_FrequentObjectStats_AllocationCacheObjectAllocation( | ||
vmThread, clazz, J9UTF8_LENGTH(J9ROMCLASS_CLASSNAME(clazz->romClass)), J9UTF8_DATA(J9ROMCLASS_CLASSNAME(clazz->romClass)), clazz->totalInstanceSize, count, (UDATA) (((float)count)*sampleFreq)); | ||
vmThread, clazz, J9UTF8_LENGTH(J9ROMCLASS_CLASSNAME(clazz->romClass)), J9UTF8_DATA(J9ROMCLASS_CLASSNAME(clazz->romClass)), clazz->totalInstanceSize, count, (uintptr_t) (((float)count)*sampleFreq)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spaces around operator *
J9VMThread *vmThread = (J9VMThread *)env->getOmrVMThread()->_language_vmthread; | ||
MM_GCExtensionsBase *extensions = env->getExtensions(); | ||
/* Should convert easily as frequentObjectAllocationSamplingRate is a UDATA representing a percentage*/ | ||
/* Should convert easily as frequentObjectAllocationSamplingRate is a uintptr_t representing a percentage*/ | ||
float sampleFreq = 100/((float) extensions->frequentObjectAllocationSamplingRate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spaces around operator /
Clean up code for FrequentObjectsStats replace U_32 with uint32_t replace UDATA with uintptr_t correct code formats Signed-off-by: lhu <[email protected]>
34a017a
to
13043e6
Compare
Jenkins compile win jdk11 |
replace U_32 with uint32_t
replace UDATA with uintptr_t
correct code formats
fix:#20449