diff options
author | kitty <kitty@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-01-31 03:33:47 +0000 |
---|---|---|
committer | kitty <kitty@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-01-31 03:33:47 +0000 |
commit | 2541b03dc95eac1440388ac748748debebf4c4cf (patch) | |
tree | 5a16458f36743b0a9515d23d8798801d368d85d9 | |
parent | c9d1ecf797aa83dabd9f6b4c94a9d382ec132199 (diff) | |
download | ATCD-2541b03dc95eac1440388ac748748debebf4c4cf.tar.gz |
ChangeLogTag: Wed Jan 31 03:25:51 UTC 2007 Krishnakumar B <kitty@nospam.invalid.domain>
-rw-r--r-- | ACE/ChangeLog | 26 | ||||
-rw-r--r-- | ACE/ace/High_Res_Timer.h | 11 | ||||
-rw-r--r-- | ACE/ace/Message_Block.cpp | 49 | ||||
-rw-r--r-- | ACE/ace/Message_Block.inl | 43 |
4 files changed, 76 insertions, 53 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog index 5f73178557b..cae27c8b86c 100644 --- a/ACE/ChangeLog +++ b/ACE/ChangeLog @@ -1,3 +1,29 @@ +Wed Jan 31 03:25:51 UTC 2007 Krishnakumar B <kitty@nospam.invalid.domain> + + * ace/High_Res_Timer.h: + + Removed the special case default definition of + ACE_HR_SCALE_CONVERSION to ACE_ONE_SECOND_IN_MSECS on Windows; + added a #ifndef around the default definition in case the user + wishes to change it. This was done to prevent useless values + like 0 showing up in calculations using ACE_Basic_Stats when the + time intervals are of the order of a few microseconds. Most of + the current machines have a QueryPerformanceCounter() + implementation that returns a value of atleast 3 MHz. So it + should be completely safe to use the definition of + ACE_ONE_SECOND_IN_USECS as the default value for + ACE_HR_SCALE_CONVERSION on contemporary x86 machines running + Windows. + + * ace/Message_Block.inl: + * ace/Message_Block.cpp: + + Moved the definition of + ACE_Dynamic_Message_Strategy::priority_status() from + Message_Block.inl to Message_Block.cpp. It was a big function + and it currently has code that causes a warning with VC8 on + Windows. + Tue Jan 30 19:21:50 UTC 2007 Chad Elliott <elliott_c@ociweb.com> * ace/Module.h: diff --git a/ACE/ace/High_Res_Timer.h b/ACE/ace/High_Res_Timer.h index 9fdbf87cf89..b6cf5f45aca 100644 --- a/ACE/ace/High_Res_Timer.h +++ b/ACE/ace/High_Res_Timer.h @@ -120,16 +120,9 @@ public: /// Returns the global_scale_factor. static ACE_UINT32 global_scale_factor (void); - // On Win32, QueryPerformanceFrequency is used as a base for the global - // scale factor. The value this returns is often too small to be usefully - // converted to "ticks"/second - it loses unacceptably high levels of - // precision. So on Win32, global_scale_factor_ is in ticks/msec, not - // ticks/usec as on all others. -#if defined (ACE_WIN32) -# define ACE_HR_SCALE_CONVERSION (ACE_ONE_SECOND_IN_MSECS) -#else +#ifndef ACE_HR_SCALE_CONVERSION # define ACE_HR_SCALE_CONVERSION (ACE_ONE_SECOND_IN_USECS) -#endif /* ACE_WIN32 */ +#endif /* ACE_HR_SCALE_CONVERSION */ /** * Sets the global_scale_factor to the value in the <env> diff --git a/ACE/ace/Message_Block.cpp b/ACE/ace/Message_Block.cpp index be94df6ddeb..d196d6a73dd 100644 --- a/ACE/ace/Message_Block.cpp +++ b/ACE/ace/Message_Block.cpp @@ -1229,6 +1229,7 @@ ACE_Data_Block::base (char *msg_data, this->flags_ = msg_flags; } + // ctor ACE_Dynamic_Message_Strategy::ACE_Dynamic_Message_Strategy (unsigned long static_bit_field_mask, @@ -1251,6 +1252,52 @@ ACE_Dynamic_Message_Strategy::~ACE_Dynamic_Message_Strategy (void) { } +ACE_Dynamic_Message_Strategy::Priority_Status +ACE_Dynamic_Message_Strategy::priority_status (ACE_Message_Block & mb, + const ACE_Time_Value & tv) +{ + // default the message to have pending priority status + Priority_Status status = ACE_Dynamic_Message_Strategy::PENDING; + + // start with the passed absolute time as the message's priority, then + // call the polymorphic hook method to (at least partially) convert + // the absolute time and message attributes into the message's priority + ACE_Time_Value priority (tv); + convert_priority (priority, mb); + + // if the priority is negative, the message is pending + if (priority < ACE_Time_Value::zero) + { + // priority for pending messages must be shifted + // upward above the late priority range + priority += pending_shift_; + if (priority < min_pending_) + priority = min_pending_; + } + // otherwise, if the priority is greater than the maximum late + // priority value that can be represented, it is beyond late + else if (priority > max_late_) + { + // all messages that are beyond late are assigned lowest priority (zero) + mb.msg_priority (0); + return ACE_Dynamic_Message_Strategy::BEYOND_LATE; + } + // otherwise, the message is late, but its priority is correct + else + status = ACE_Dynamic_Message_Strategy::LATE; + + // use (fast) bitwise operators to isolate and replace + // the dynamic portion of the message's priority + mb.msg_priority((mb.msg_priority() & static_bit_field_mask_) | + ((priority.usec () + + ACE_ONE_SECOND_IN_USECS * priority.sec ()) << + static_bit_field_shift_)); + + // returns the priority status of the message + return status; +} + + // Dump the state of the strategy. void @@ -1284,7 +1331,7 @@ ACE_Dynamic_Message_Strategy::dump (void) const #endif /* ACE_HAS_DUMP */ } -ACE_Deadline_Message_Strategy:: ACE_Deadline_Message_Strategy (unsigned long static_bit_field_mask, +ACE_Deadline_Message_Strategy::ACE_Deadline_Message_Strategy (unsigned long static_bit_field_mask, unsigned long static_bit_field_shift, unsigned long dynamic_priority_max, unsigned long dynamic_priority_offset) diff --git a/ACE/ace/Message_Block.inl b/ACE/ace/Message_Block.inl index 2f67cc25078..85261360be6 100644 --- a/ACE/ace/Message_Block.inl +++ b/ACE/ace/Message_Block.inl @@ -579,48 +579,5 @@ ACE_Dynamic_Message_Strategy::dynamic_priority_offset (unsigned long ul) // set offset for boundary between signed range and unsigned range -ACE_INLINE ACE_Dynamic_Message_Strategy::Priority_Status -ACE_Dynamic_Message_Strategy::priority_status (ACE_Message_Block & mb, - const ACE_Time_Value & tv) -{ - // default the message to have pending priority status - Priority_Status status = ACE_Dynamic_Message_Strategy::PENDING; - - // start with the passed absolute time as the message's priority, then - // call the polymorphic hook method to (at least partially) convert - // the absolute time and message attributes into the message's priority - ACE_Time_Value priority (tv); - convert_priority (priority, mb); - - // if the priority is negative, the message is pending - if (priority < ACE_Time_Value::zero) - { - // priority for pending messages must be shifted - // upward above the late priority range - priority += pending_shift_; - if (priority < min_pending_) - priority = min_pending_; - } - // otherwise, if the priority is greater than the maximum late - // priority value that can be represented, it is beyond late - else if (priority > max_late_) - { - // all messages that are beyond late are assigned lowest priority (zero) - mb.msg_priority (0); - return ACE_Dynamic_Message_Strategy::BEYOND_LATE; - } - // otherwise, the message is late, but its priority is correct - else - status = ACE_Dynamic_Message_Strategy::LATE; - - // use (fast) bitwise operators to isolate and replace - // the dynamic portion of the message's priority - mb.msg_priority((mb.msg_priority() & static_bit_field_mask_) | - ((priority.usec () + ACE_ONE_SECOND_IN_USECS * priority.sec ()) << - static_bit_field_shift_)); - - return status; -} - // returns the priority status of the message ACE_END_VERSIONED_NAMESPACE_DECL |