Changeset 3c039b0


Ignore:
Timestamp:
May 4, 2020, 4:20:31 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
61dd73d
Parents:
6502a2b
Message:

Split Complete I/O statistics into fast and slow

Location:
libcfa/src/concurrency
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/io.cfa

    r6502a2b r3c039b0  
    204204                        this.io.submit_q.stats.submit_avg.cnt = 0;
    205205                        this.io.completion_q.stats.completed_avg.val = 0;
    206                         this.io.completion_q.stats.completed_avg.cnt = 0;
     206                        this.io.completion_q.stats.completed_avg.slow_cnt = 0;
     207                        this.io.completion_q.stats.completed_avg.fast_cnt = 0;
    207208                #endif
    208209
     
    269270                                        "- total submit calls  : %llu\n"
    270271                                        "- avg submit          : %lf\n"
    271                                         "- total wait calls    : %llu\n"
     272                                        "- total wait calls    : %llu (%llu slow, %llu fast)\n"
    272273                                        "- avg completion/wait : %lf\n",
    273274                                        this.io.submit_q.stats.submit_avg.cnt,
    274275                                        ((double)this.io.submit_q.stats.submit_avg.val) / this.io.submit_q.stats.submit_avg.cnt,
    275                                         this.io.completion_q.stats.completed_avg.cnt,
    276                                         ((double)this.io.completion_q.stats.completed_avg.val) / this.io.completion_q.stats.completed_avg.cnt
     276                                        this.io.completion_q.stats.completed_avg.slow_cnt + this.io.completion_q.stats.completed_avg.fast_cnt,
     277                                        this.io.completion_q.stats.completed_avg.slow_cnt, this.io.completion_q.stats.completed_avg.fast_cnt,
     278                                        ((double)this.io.completion_q.stats.completed_avg.val) / (this.io.completion_q.stats.completed_avg.slow_cnt + this.io.completion_q.stats.completed_avg.fast_cnt)
    277279                                );
    278280                        }
     
    326328                // Nothing was new return 0
    327329                if (head == tail) {
    328                         #if !defined(__CFA_NO_STATISTICS__)
    329                                 ring.completion_q.stats.completed_avg.cnt += 1;
    330                         #endif
    331330                        return 0;
    332331                }
     
    354353                __atomic_fetch_add( ring.completion_q.head, count, __ATOMIC_RELAXED );
    355354
    356                 // Update statistics
    357                 #if !defined(__CFA_NO_STATISTICS__)
    358                         ring.completion_q.stats.completed_avg.val += count;
    359                         ring.completion_q.stats.completed_avg.cnt += 1;
    360                 #endif
    361 
    362355                return count;
    363356        }
     
    386379                                // batton pass to the user-thread
    387380                                int count = __drain_io( ring, &mask, 1, true );
     381
     382                                // Update statistics
     383                                #if !defined(__CFA_NO_STATISTICS__)
     384                                        ring.completion_q.stats.completed_avg.val += count;
     385                                        ring.completion_q.stats.completed_avg.slow_cnt += 1;
     386                                #endif
     387
    388388                                if(count > 0) {
    389389                                        __cfadbg_print_safe(io_core, "Kernel I/O : Moving to ring %p to fast poller\n", &ring);
     
    395395
    396396                                //In the naive approach, just poll the io completion queue directly
    397                                 __drain_io( ring, &mask, 1, true );
     397                                int count = __drain_io( ring, &mask, 1, true );
     398
     399                                // Update statistics
     400                                #if !defined(__CFA_NO_STATISTICS__)
     401                                        ring.completion_q.stats.completed_avg.val += count;
     402                                        ring.completion_q.stats.completed_avg.slow_cnt += 1;
     403                                #endif
    398404
    399405                        #endif
     
    416422                                // Drain the io
    417423                                this.waiting = false;
    418                                 int ret = __drain_io( *this.ring, 0p, 0, false );
     424                                int count = __drain_io( *this.ring, 0p, 0, false );
     425
     426                                // Update statistics
     427                                #if !defined(__CFA_NO_STATISTICS__)
     428                                        this.ring->completion_q.stats.completed_avg.val += count;
     429                                        this.ring->completion_q.stats.completed_avg.fast_cnt += 1;
     430                                #endif
     431
    419432                                this.waiting = true;
    420                                 if(0 > ret) {
     433                                if(0 > count) {
    421434                                        // If we got something, just yield and check again
    422435                                        yield();
  • libcfa/src/concurrency/kernel.hfa

    r6502a2b r3c039b0  
    182182                        struct {
    183183                                unsigned long long int val;
    184                                 unsigned long long int cnt;
     184                                unsigned long long int slow_cnt;
     185                                unsigned long long int fast_cnt;
    185186                        } completed_avg;
    186187                } stats;
Note: See TracChangeset for help on using the changeset viewer.