+
+ if (!useset)
+ return NULL;
+
+ if (verbose < 1)
+ return NULL;
+
+ uint64_t deltans = 0;
+ /*
+ * If we're using multiple sets, explicitly tear them all down
+ * and measure the time.
+ */
+ for (int ns = 0; ns < setcount; ns++) {
+ if (verbose > 1)
+ printf("\tTearing down set[%d] %#x...\n", ns, args->set[ns]);
+ starttm = mach_absolute_time();
+ ret = mach_port_mod_refs(mach_task_self(), args->set[ns], MACH_PORT_RIGHT_PORT_SET, -1);
+ endtm = mach_absolute_time();
+ deltans += abs_to_ns(endtm - starttm);
+ if (ret != KERN_SUCCESS) {
+ mach_error("mach_port_mod_refs(): ", ret);
+ exit(1);
+ }
+ }
+
+ uint64_t nlinks = (uint64_t)setcount * (uint64_t)portcount;
+
+ printf("\tteardown of %llu links took %llu ns\n", nlinks, deltans);
+ printf("\t%lluns per set\n", deltans / (uint64_t)setcount);
+
+ return NULL;