public int getSizeOfLocalPrimaryBuckets() {
    int sizeOfLocalPrimaries = 0;
    Set<BucketRegion> primaryBuckets = getAllLocalPrimaryBucketRegions();
    for (BucketRegion br : primaryBuckets) {
      sizeOfLocalPrimaries += br.size();
    }
    return sizeOfLocalPrimaries;
  }
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