From 7f86135e874aeb1f7dfe06d6f1eec4f71125b4e3 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 7 May 2022 11:11:55 -0700 Subject: [PATCH] label: remove unused 'RTree' statistics The documentation for this was also inaccurate; `SeTouchCount` was manipulated even when `StatFlag` was unsett. --- lib/label/index.c | 23 ----------------------- lib/label/index.h | 24 ------------------------ lib/label/node.c | 4 ---- lib/label/split.q.c | 10 ---------- 4 files changed, 61 deletions(-) diff --git a/lib/label/index.c b/lib/label/index.c index ce34522d4..108061b4e 100644 --- a/lib/label/index.c +++ b/lib/label/index.c @@ -75,9 +75,6 @@ static int RTreeClose2(RTree_t * rtp, Node_t * n) if (!RTreeClose2(rtp, n->branch[i].child)) { free(n->branch[i].child); DisconBranch(n, i); - rtp->EntryCount--; - if (rtp->StatFlag) - rtp->ElimCount++; } } } else { @@ -85,9 +82,6 @@ static int RTreeClose2(RTree_t * rtp, Node_t * n) if (!n->branch[i].child) continue; DisconBranch(n, i); - rtp->EntryCount--; - if (rtp->StatFlag) - rtp->ElimCount++; } } return 0; @@ -153,8 +147,6 @@ LeafList_t *RTreeSearch(RTree_t * rtp, Node_t * n, Rect_t * r) assert(n->level >= 0); assert(r); - rtp->SeTouchCount++; - if (n->level > 0) { /* this is an internal node in the tree */ for (size_t i = 0; i < NODECARD; i++) if (n->branch[i].child && Overlap(r, &n->branch[i].rect)) { @@ -205,15 +197,7 @@ int RTreeInsert(RTree_t * rtp, Rect_t * r, void *data, Node_t ** n, int level) fprintf(stderr, "RTreeInsert level=%d\n", level); # endif - if (rtp->StatFlag) { - rtp->InsertCount++; - } - rtp->RectCount++; - if (RTreeInsert2(rtp, r, data, *n, &newnode, level)) { /* root was split */ - if (rtp->StatFlag) { - rtp->InTouchCount++; - } Node_t *newroot = RTreeNewNode(rtp); /* grow a new root, make tree taller */ newroot->level = (*n)->level + 1; @@ -224,7 +208,6 @@ int RTreeInsert(RTree_t * rtp, Rect_t * r, void *data, Node_t ** n, int level) b.child = newnode; AddBranch(rtp, &b, newroot, NULL); *n = newroot; - rtp->EntryCount += 2; result = 1; } @@ -249,10 +232,6 @@ RTreeInsert2(RTree_t * rtp, Rect_t * r, void *data, assert(r && n && new); assert(level >= 0 && level <= n->level); - if (rtp->StatFlag) { - rtp->InTouchCount++; - } - /* Still above level for insertion, go down tree recursively */ if (n->level > level) { int i = PickBranch(r, n); @@ -263,14 +242,12 @@ RTreeInsert2(RTree_t * rtp, Rect_t * r, void *data, n->branch[i].rect = NodeCover(n->branch[i].child); b.child = n2; b.rect = NodeCover(n2); - rtp->EntryCount++; return AddBranch(rtp, &b, n, new); } } else if (n->level == level) { /* at level for insertion. */ /*Add rect, split if necessary */ b.rect = *r; b.child = (Node_t *) data; - rtp->EntryCount++; return AddBranch(rtp, &b, n, new); } else { /* Not supposed to happen */ assert(FALSE); diff --git a/lib/label/index.h b/lib/label/index.h index 25c816a9d..fb51d6107 100644 --- a/lib/label/index.h +++ b/lib/label/index.h @@ -76,30 +76,6 @@ typedef struct LeafList { /* times */ long ElapsedTime; float UserTime, SystemTime; - - /* variables for statistics */ - int StatFlag; /* tells if we are counting or not */ - /* counters affected only when StatFlag set */ - int InsertCount; - int DeleteCount; - int ReInsertCount; - int InSplitCount; - int DeSplitCount; - int ElimCount; - int EvalCount; - int InTouchCount; - int DeTouchCount; - int SeTouchCount; - int CallCount; - float SplitMeritSum; - - /* counters used even when StatFlag not set */ - int RectCount; - int NodeCount; - int EntryCount; - int SearchCount; - int HitCount; - }; typedef struct ListNode { diff --git a/lib/label/node.c b/lib/label/node.c index d4febbd7e..812d7296c 100644 --- a/lib/label/node.c +++ b/lib/label/node.c @@ -21,7 +21,6 @@ */ Node_t *RTreeNewNode(RTree_t * rtp) { - rtp->NodeCount++; Node_t *n = malloc(sizeof(Node_t)); InitNode(n); return n; @@ -162,9 +161,6 @@ int AddBranch(RTree_t * rtp, Branch_t * b, Node_t * n, Node_t ** new) assert(i < NODECARD); return 0; } else { - if (rtp->StatFlag) { - rtp->InTouchCount++; - } assert(new); SplitNode(rtp, n, b, new); return 1; diff --git a/lib/label/split.q.c b/lib/label/split.q.c index 0fb510a16..f5af9a16c 100644 --- a/lib/label/split.q.c +++ b/lib/label/split.q.c @@ -42,10 +42,6 @@ void SplitNode(RTree_t * rtp, Node_t * n, Branch_t * b, Node_t ** nn) PrintBranch(-1, b); #endif - if (rtp->StatFlag) { - rtp->InSplitCount++; - } - /* load all the branches into a buffer, initialize old node */ int level = n->level; GetBranches(rtp, n, b); @@ -64,12 +60,6 @@ void SplitNode(RTree_t * rtp, Node_t * n, Branch_t * b, Node_t ** nn) struct PartitionVars *p = &rtp->split.Partitions[0]; MethodZero(rtp); - int area = RectArea(&p->cover[0]) + RectArea(&p->cover[1]); - - /* record how good the split was for statistics */ - if (rtp->StatFlag && area) - rtp->SplitMeritSum += (float) rtp->split.CoverSplitArea / area; - /* put branches from buffer into 2 nodes according to chosen partition */ *nn = RTreeNewNode(rtp); (*nn)->level = n->level = level; -- 2.40.0