public int getSizeOfLocalBuckets() {
    int sizeOfLocal = 0;
    Set<BucketRegion> allLocalBuckets = getAllLocalBucketRegions();
    for (BucketRegion br : allLocalBuckets) {
      sizeOfLocal += br.size();
    }
    return sizeOfLocal;
  }
This calculates size of all the primary bucket regions for the list of bucketIds.

@return the size of all the primary bucket regions for the list of bucketIds.
geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java