void qht_statistics_init(struct qht *ht, struct qht_stats *stats)

{

    struct qht_map *map;

    int i;



    map = atomic_rcu_read(&ht->map);



    stats->head_buckets = map->n_buckets;

    stats->used_head_buckets = 0;

    stats->entries = 0;

    qdist_init(&stats->chain);

    qdist_init(&stats->occupancy);



    for (i = 0; i < map->n_buckets; i++) {

        struct qht_bucket *head = &map->buckets[i];

        struct qht_bucket *b;

        unsigned int version;

        size_t buckets;

        size_t entries;

        int j;



        do {

            version = seqlock_read_begin(&head->sequence);

            buckets = 0;

            entries = 0;

            b = head;

            do {

                for (j = 0; j < QHT_BUCKET_ENTRIES; j++) {

                    if (atomic_read(&b->pointers[j]) == NULL) {

                        break;

                    }

                    entries++;

                }

                buckets++;

                b = atomic_rcu_read(&b->next);

            } while (b);

        } while (seqlock_read_retry(&head->sequence, version));



        if (entries) {

            qdist_inc(&stats->chain, buckets);

            qdist_inc(&stats->occupancy,

                      (double)entries / QHT_BUCKET_ENTRIES / buckets);

            stats->used_head_buckets++;

            stats->entries += entries;

        } else {

            qdist_inc(&stats->occupancy, 0);

        }

    }

}

void qht_statistics_init(struct qht *ht, struct qht_stats *stats)

{

    struct qht_map *map;

    int i;



    map = atomic_rcu_read(&ht->map);



    stats->head_buckets = map->n_buckets;

    stats->used_head_buckets = 0;

    stats->entries = 0;

    qdist_init(&stats->chain);

    qdist_init(&stats->occupancy);



    for (i = 0; i < map->n_buckets; i++) {

        struct qht_bucket *head = &map->buckets[i];

        struct qht_bucket *b;

        unsigned int version;

        size_t buckets;

        size_t entries;

        int j;



        do {

            version = seqlock_read_begin(&head->sequence);

            buckets = 0;

            entries = 0;

            b = head;

            do {

                for (j = 0; j < QHT_BUCKET_ENTRIES; j++) {

                    if (atomic_read(&b->pointers[j]) == NULL) {

                        break;

                    }

                    entries++;

                }

                buckets++;

                b = atomic_rcu_read(&b->next);

            } while (b);

        } while (seqlock_read_retry(&head->sequence, version));



        if (entries) {

            qdist_inc(&stats->chain, buckets);

            qdist_inc(&stats->occupancy,

                      (double)entries / QHT_BUCKET_ENTRIES / buckets);

            stats->used_head_buckets++;

            stats->entries += entries;

        } else {

            qdist_inc(&stats->occupancy, 0);

        }

    }

}

    stats->head_buckets = map->n_buckets;
void FUNC_0(struct qht *VAR_0, struct qht_stats *VAR_1)

{

    struct qht_map *VAR_2;

    int VAR_3;



    VAR_2 = atomic_rcu_read(&VAR_0->VAR_2);



    VAR_1->head_buckets = VAR_2->n_buckets;

    VAR_1->used_head_buckets = 0;

    VAR_1->entries = 0;

    qdist_init(&VAR_1->chain);

    qdist_init(&VAR_1->occupancy);



    for (VAR_3 = 0; VAR_3 < VAR_2->n_buckets; VAR_3++) {

        struct qht_bucket *VAR_4 = &VAR_2->buckets[VAR_3];

        struct qht_bucket *VAR_5;

        unsigned int VAR_6;

        size_t buckets;

        size_t entries;

        int VAR_7;



        do {

            VAR_6 = seqlock_read_begin(&VAR_4->sequence);

            buckets = 0;

            entries = 0;

            VAR_5 = VAR_4;

            do {

                for (VAR_7 = 0; VAR_7 < QHT_BUCKET_ENTRIES; VAR_7++) {

                    if (atomic_read(&VAR_5->pointers[VAR_7]) == NULL) {

                        break;

                    }

                    entries++;

                }

                buckets++;

                VAR_5 = atomic_rcu_read(&VAR_5->next);

            } while (VAR_5);

        } while (seqlock_read_retry(&VAR_4->sequence, VAR_6));



        if (entries) {

            qdist_inc(&VAR_1->chain, buckets);

            qdist_inc(&VAR_1->occupancy,

                      (double)entries / QHT_BUCKET_ENTRIES / buckets);

            VAR_1->used_head_buckets++;

            VAR_1->entries += entries;

        } else {

            qdist_inc(&VAR_1->occupancy, 0);

        }

    }

}

void FUNC_0(struct qht *VAR_0, struct qht_stats *VAR_1)
{ struct qht_map *VAR_2; int VAR_3; VAR_2 = atomic_rcu_read(&VAR_0->VAR_2); VAR_1->head_buckets = VAR_2->n_buckets; VAR_1->used_head_buckets = 0; VAR_1->entries = 0; qdist_init(&VAR_1->chain); qdist_init(&VAR_1->occupancy); for (VAR_3 = 0; VAR_3 < VAR_2->n_buckets; VAR_3++) { struct qht_bucket *VAR_4 = &VAR_2->buckets[VAR_3]; struct qht_bucket *VAR_5; unsigned int VAR_6; size_t buckets; size_t entries; int VAR_7; do { VAR_6 = seqlock_read_begin(&VAR_4->sequence); buckets = 0; entries = 0; VAR_5 = VAR_4; do { for (VAR_7 = 0; VAR_7 < QHT_BUCKET_ENTRIES; VAR_7++) { if (atomic_read(&VAR_5->pointers[VAR_7]) == NULL) { break; } entries++; } buckets++; VAR_5 = atomic_rcu_read(&VAR_5->next); } while (VAR_5); } while (seqlock_read_retry(&VAR_4->sequence, VAR_6)); if (entries) { qdist_inc(&VAR_1->chain, buckets); qdist_inc(&VAR_1->occupancy,
(double)entries / QHT_BUCKET_ENTRIES / buckets); VAR_1->used_head_buckets++; VAR_1->entries += entries; } else { qdist_inc(&VAR_1->occupancy, 0); } } }