Changeset c382cc83 in rtems


Ignore:
Timestamp:
Jul 30, 2016, 9:25:57 AM (3 years ago)
Author:
Konstantin Belousov <kib@…>
Branches:
master
Children:
74887157
Parents:
b48aeaf
git-author:
Konstantin Belousov <kib@…> (07/30/16 09:25:57)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/12/17 05:04:11)
Message:

timecounter: Merge FreeBSD change r303548

Cache getbintime(9) answer in timehands, similarly to getnanotime(9) and getmicrotime(9).

Suggested and reviewed by: bde (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 month

Update #3175.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/src/kern_tc.c

    rb48aeaf rc382cc83  
    152152        uint32_t                th_offset_count;
    153153        struct bintime          th_offset;
     154        struct bintime          th_bintime;
    154155        struct timeval          th_microtime;
    155156        struct timespec         th_nanotime;
     
    176177        .th_generation = 1,
    177178#ifdef __rtems__
     179        .th_bintime = { .sec = TOD_SECONDS_1970_THROUGH_1988 },
    178180        .th_microtime = { TOD_SECONDS_1970_THROUGH_1988, 0 },
    179181        .th_nanotime = { TOD_SECONDS_1970_THROUGH_1988, 0 },
     
    347349                th = timehands;
    348350                gen = atomic_load_acq_int(&th->th_generation);
    349                 *bt = th->th_offset;
     351                *bt = th->th_bintime;
    350352                bintime_addx(bt, th->th_scale * tc_delta(th));
    351                 bintime_add(bt, &th->th_boottime);
    352353                atomic_thread_fence_acq();
    353354        } while (gen == 0 || gen != th->th_generation);
     
    423424                th = timehands;
    424425                gen = atomic_load_acq_int(&th->th_generation);
    425                 *bt = th->th_offset;
    426                 bintime_add(bt, &th->th_boottime);
     426                *bt = th->th_bintime;
    427427                atomic_thread_fence_acq();
    428428        } while (gen == 0 || gen != th->th_generation);
     
    518518                th = timehands;
    519519                gen = atomic_load_acq_int(&th->th_generation);
    520                 *bt = th->th_offset;
     520                *bt = th->th_bintime;
    521521                bintime_addx(bt, th->th_scale * tc_delta(th));
    522                 bintime_add(bt, &th->th_boottime);
    523522                atomic_thread_fence_acq();
    524523        } while (gen == 0 || gen != th->th_generation);
     
    594593                th = timehands;
    595594                gen = atomic_load_acq_int(&th->th_generation);
    596                 *bt = th->th_offset;
    597                 bintime_add(bt, &th->th_boottime);
     595                *bt = th->th_bintime;
    598596                atomic_thread_fence_acq();
    599597        } while (gen == 0 || gen != th->th_generation);
     
    15681566                        th->th_boottime.sec += bt.sec - t;
    15691567        }
     1568        th->th_bintime = th->th_offset;
     1569        bintime_add(&th->th_bintime, &th->th_boottime);
    15701570        /* Update the UTC timestamps used by the get*() functions. */
    15711571        /* XXX shouldn't do this here.  Should force non-`get' versions. */
     
    20012001        tcount = pps->capcount - pps->capth->th_offset_count;
    20022002        tcount &= pps->capth->th_counter->tc_counter_mask;
    2003         bt = pps->capth->th_offset;
     2003        bt = pps->capth->th_bintime;
    20042004        bintime_addx(&bt, pps->capth->th_scale * tcount);
    2005         bintime_add(&bt, &pps->capth->th_boottime);
    20062005        bintime2timespec(&bt, &ts);
    20072006
     
    21182117
    21192118        bt = th->th_offset;
     2119        bintime_add(&bt, &th->th_boottime);
     2120        /* Update the UTC timestamps used by the get*() functions. */
    21202121        th->th_bintime = bt;
    2121         bintime_add(&th->th_bintime, &th->th_boottime);
    2122         /* Update the UTC timestamps used by the get*() functions. */
    2123         /* XXX shouldn't do this here.  Should force non-`get' versions. */
    21242122        bintime2timeval(&bt, &th->th_microtime);
    21252123        bintime2timespec(&bt, &th->th_nanotime);
Note: See TracChangeset for help on using the changeset viewer.