Ignore:
Timestamp:
Mar 22, 2022, 3:28:29 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
ff7b2de
Parents:
8f01ad71
Message:

I/O now updates the timestamps when draining.
Timestamps are not used yet.

Location:
libcfa/src/concurrency/kernel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/kernel/cluster.cfa

    r8f01ad71 r78a580d  
    2727
    2828#include "ready_subqueue.hfa"
     29#include "io/types.hfa"
    2930
    3031#include <errno.h>
     
    259260                it->rdq.id = valrq;
    260261                it->rdq.target = MAX;
    261                 it->io.id = valio;
     262                it->io.ctx->cq.id = valio;
    262263                it->io.target = MAX;
    263264                valrq += __shard_factor.readyq;
     
    278279        while(it) {
    279280                /* paranoid */ verifyf( it, "Unexpected null iterator\n");
    280                 /* paranoid */ verifyf( it->io.id < count, "Processor %p has id %u above count %zu\n", it, it->rdq.id, count);
    281                 data[it->io.id] = it->io.ctx;
     281                /* paranoid */ verifyf( it->io.ctx->cq.id < count, "Processor %p has id %u above count %zu\n", it, it->rdq.id, count);
     282                data[it->io.ctx->cq.id] = it->io.ctx;
    282283                it = &(*it)`next;
    283284        }
  • libcfa/src/concurrency/kernel/cluster.hfa

    r8f01ad71 r78a580d  
    1616#pragma once
    1717
     18#include "device/cpu.hfa"
    1819#include "kernel/private.hfa"
     20
     21#include "limits.hfa"
    1922
    2023//-----------------------------------------------------------------------
     
    3134        const unsigned long long ret = ((new_weight * new_val) + (old_weight * old_avg)) / total_weight;
    3235        return ret;
     36}
     37
     38static inline void touch_tsc(__timestamp_t * tscs, size_t idx, unsigned long long ts_prev, unsigned long long ts_next) {
     39        if (ts_next == MAX) return;
     40        unsigned long long now = rdtscl();
     41        unsigned long long pma = __atomic_load_n(&tscs[ idx ].ma, __ATOMIC_RELAXED);
     42        __atomic_store_n(&tscs[ idx ].tv, ts_next, __ATOMIC_RELAXED);
     43        __atomic_store_n(&tscs[ idx ].ma, moving_average(now, ts_prev, pma), __ATOMIC_RELAXED);
    3344}
    3445
  • libcfa/src/concurrency/kernel/startup.cfa

    r8f01ad71 r78a580d  
    233233        /* paranoid */ verify( sizeof(storage_mainIdleEventFd) == sizeof(eventfd_t) );
    234234
     235        __cfa_io_start( mainProcessor );
    235236        register_tls( mainProcessor );
    236         __cfa_io_start( mainProcessor );
    237237
    238238        // Start by initializing the main thread
     
    314314        mainProcessor->local_data = 0p;
    315315
     316        unregister_tls( mainProcessor );
    316317        __cfa_io_stop( mainProcessor );
    317         unregister_tls( mainProcessor );
    318318
    319319        // Destroy the main processor and its context in reverse order of construction
     
    364364        proc->local_data = &__cfaabi_tls;
    365365
     366        __cfa_io_start( proc );
    366367        register_tls( proc );
    367 
    368         __cfa_io_start( proc );
    369368
    370369        // used for idle sleep when io_uring is present
     
    401400        // Main routine of the core returned, the core is now fully terminated
    402401        __cfadbg_print_safe(runtime_core, "Kernel : core %p main ended (%p)\n", proc, &proc->runner);
    403 
    404         __cfa_io_stop( proc );
    405402
    406403        #if !defined(__CFA_NO_STATISTICS__)
     
    417414
    418415        unregister_tls( proc );
     416        __cfa_io_stop( proc );
    419417
    420418        return 0p;
Note: See TracChangeset for help on using the changeset viewer.