View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006008VTK(No Category)public2007-11-05 14:362008-06-03 14:47
ReporterSean McBride 
Assigned ToSean McBride 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformMac OS XOSMac OS XOS Version10.5
Product Version 
Target VersionFixed in Version 
Summary0006008: vtkTimeStamp & itkTimeStamp atomic increment optimisation and cleanup patch
DescriptionAfter profiling our application, we discovered that significant time is spent in vtkTimeStamp::Modified(). Time was lost because a mutex was being taken to safely increment an integer. A mutex is a fairly expensive construct. A Windows-only optimisation exists in the code that uses the InterlockedIncrement() API to atomically increment the number without the need for a mutex. Mac OS X has a similar API.

This patch:
 - makes the analogous optimisation on Mac OS (10.4 and later only) in both vtk and itk
 - adds the Windows optimisation to the ITK version of TimeStamp
 - changed the return type of operator> and operator< from int to bool
 - other misc changes to make the two classes less divergent (added consts, etc.)

I have been using this code for weeks now on Mac OS X 10.5 in both 32 and 64 bit, and it seems just fine. I have not tested on other OSes however.

I could commit this myself, but I would appreciate someone review the changes first.
TagsNo tags attached.
Project
Type
Attached Filestxt file icon vtkTimeStampPatch.txt [^] (1,778 bytes) 2007-11-05 14:36 [Show Content]
txt file icon itkTimeStampPatch.txt [^] (1,734 bytes) 2007-11-05 14:36 [Show Content]

 Relationships

  Notes
(0009651)
Brad King (developer)
2007-11-07 10:38

For reference, atomic increments are available on other architectures also:

  http://www.boost.org/boost/detail/sp_counted_base_gcc_ia64.hpp [^]
  http://www.boost.org/boost/detail/sp_counted_base_gcc_ppc.hpp [^]
  http://www.boost.org/boost/detail/sp_counted_base_gcc_x86.hpp [^]

and other sp_counted_base_* files in

  http://www.boost.org/boost/detail [^]
(0009679)
Sean McBride (developer)
2007-11-14 18:32

I will be checking this in in a few days, as David has given me the 'go ahead'.

Brad, that's interesting. Perhaps long-term, boost can be used, as it would eliminate all the #if's.
(0009704)
Sean McBride (developer)
2007-11-19 11:01

/cvsroot/VTK/VTK/Common/vtkTimeStamp.cxx,v <-- vtkTimeStamp.cxx
new revision: 1.32; previous revision: 1.31
/cvsroot/VTK/VTK/Common/vtkTimeStamp.h,v <-- vtkTimeStamp.h
new revision: 1.47; previous revision: 1.46

/cvsroot/Insight/Insight/Code/Common/itkTimeStamp.cxx,v <-- itkTimeStamp.cxx
new revision: 1.12; previous revision: 1.11
/cvsroot/Insight/Insight/Code/Common/itkTimeStamp.h,v <-- itkTimeStamp.h
new revision: 1.20; previous revision: 1.19

 Issue History
Date Modified Username Field Change
2007-11-05 14:36 Sean McBride New Issue
2007-11-05 14:36 Sean McBride Status backlog => tabled
2007-11-05 14:36 Sean McBride Assigned To => David Cole
2007-11-05 14:36 Sean McBride File Added: vtkTimeStampPatch.txt
2007-11-05 14:36 Sean McBride File Added: itkTimeStampPatch.txt
2007-11-07 10:38 Brad King Note Added: 0009651
2007-11-14 18:32 Sean McBride Note Added: 0009679
2007-11-14 18:32 Sean McBride Assigned To David Cole => Sean McBride
2007-11-19 11:01 Sean McBride Status tabled => @80@
2007-11-19 11:01 Sean McBride Resolution open => fixed
2007-11-19 11:01 Sean McBride Note Added: 0009704
2008-06-03 14:47 Sean McBride Status @80@ => closed
2011-06-16 13:11 Zack Galbreath Category => (No Category)


Copyright © 2000 - 2018 MantisBT Team