Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/kernel.hfa

    r2d8f7b0 rf6660520  
    4040void   P (semaphore & this);
    4141bool   V (semaphore & this);
     42bool   V (semaphore & this, unsigned count);
    4243
    4344
     
    135136        // Like head/tail but not seen by the kernel
    136137        volatile uint32_t alloc;
     138        volatile uint32_t ready;
    137139
    138140        __spinlock_t lock;
     
    144146        void * ring_ptr;
    145147        size_t ring_sz;
     148
     149        // Statistics
     150        #if !defined(__CFA_NO_STATISTICS__)
     151                struct {
     152                        struct {
     153                                unsigned long long int val;
     154                                unsigned long long int cnt;
     155                        } submit_avg;
     156                } stats;
     157        #endif
    146158};
    147159
     
    164176        void * ring_ptr;
    165177        size_t ring_sz;
    166 };
     178
     179        // Statistics
     180        #if !defined(__CFA_NO_STATISTICS__)
     181                struct {
     182                        struct {
     183                                unsigned long long int val;
     184                                unsigned long long int cnt;
     185                        } completed_avg;
     186                } stats;
     187        #endif
     188};
     189
     190#if defined(__CFA_IO_POLLING_USER__)
     191        struct __io_poller_fast {
     192                struct io_ring * ring;
     193                $thread thrd;
     194        };
     195#endif
    167196
    168197struct io_ring {
     
    171200        uint32_t flags;
    172201        int fd;
    173         pthread_t poller;
    174         void * stack;
     202        semaphore submit;
    175203        volatile bool done;
    176         semaphore submit;
     204        struct {
     205                struct {
     206                        void * stack;
     207                        pthread_t kthrd;
     208                } slow;
     209                #if defined(__CFA_IO_POLLING_USER__)
     210                        __io_poller_fast fast;
     211                        __bin_sem_t sem;
     212                #endif
     213        } poller;
    177214};
    178215#endif
     
    213250                struct io_ring io;
    214251        #endif
     252
     253        #if !defined(__CFA_NO_STATISTICS__)
     254                bool print_stats;
     255        #endif
    215256};
    216257extern Duration default_preemption();
     
    227268static inline struct processor * active_processor() { return TL_GET( this_processor ); } // UNSAFE
    228269static inline struct cluster   * active_cluster  () { return TL_GET( this_processor )->cltr; }
     270
     271#if !defined(__CFA_NO_STATISTICS__)
     272        static inline void print_stats_at_exit( cluster & this ) {
     273                this.print_stats = true;
     274        }
     275#endif
    229276
    230277// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.