United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 6326015 HPROF: format=b timestamp is incorrect
6326015 : HPROF: format=b timestamp is incorrect

Details
Type:
Bug
Submit Date:
2005-09-19
Status:
Resolved
Updated Date:
2010-04-02
Project Name:
JDK
Resolved Date:
2005-12-22
Component:
tools
OS:
generic
Sub-Component:
hprof
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:
5.0u7

Related Reports
Relates:

Sub Tasks

Description
The timestamp in the format=b output is incorrect, the jlong arithmetic calculation can cause some problems due to a C compiler bug.

                                    

Comments
SUGGESTED FIX

######### File: ./hprof_md.c
######### (cd . && sccs diffs -C -w -s -b hprof_md.c)

------- hprof_md.c -------
*** /tmp/sccs.T2ayOl    Wed Sep 28 18:23:27 2005
--- hprof_md.c  Wed Sep 28 18:22:43 2005
***************
*** 243,249 ****
  jlong 
  md_get_timemillis(void)
  {
!     return md_millisecs();
  }
  
  jlong
--- 243,254 ----
  jlong 
  md_get_timemillis(void)
  {
!     struct timeval tv;
!  
!     (void)gettimeofday(&tv, (void *)0);
!     /*LINTED*/
!     return (jlong)(((jlong)tv.tv_sec * (jlong)1000) + 
!                  ((jlong)tv.tv_usec / (jlong)1000));
  }
  
  jlong
                                     
2005-09-29
EVALUATION

Make sure the time stamp in the hprof file is a gettimeofday stamp, and make sure the jlong casts insure proper arithmetic promotions (some issues with C compiler in this area).
See suggested fix.
                                     
2005-09-29



Hardware and Software, Engineered to Work Together