Fixed more troubles with test_cpu_pulse().

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@964 35acf78f-673a-0410-8e92-d51de3d6d3f4
master
gdisirio 2009-05-09 19:36:30 +00:00
parent 83d50f0821
commit 6d3145c04b
2 changed files with 8 additions and 3 deletions

View File

@ -51,7 +51,7 @@ struct Thread {
cnt_t p_locks; /**< Number of nested locks.*/
#endif
#if CH_DBG_THREADS_PROFILING
systime_t p_time; /**< Consumed time.
volatile systime_t p_time; /**< Consumed time.
@note This field can overflow.*/
#endif
/*

View File

@ -177,13 +177,18 @@ void test_wait_threads(void) {
#if CH_DBG_THREADS_PROFILING
void test_cpu_pulse(unsigned duration) {
systime_t start, end, now;
systime_t end = chThdSelf()->p_time + MS2ST(duration);
while (chThdSelf()->p_time < end) {
start = chThdSelf()->p_time;
end = start + MS2ST(duration);
do {
now = chThdSelf()->p_time;
#if defined(WIN32)
ChkIntSources();
#endif
}
while (end > start ? (now >= start) && (now < end) :
(now >= start) || (now < end));
}
#endif