Lines Matching refs:snap

55 static int lgrp_cpus_hier(lgrp_snapshot_header_t *snap, lgrp_id_t lgrp,
145 parent_orphans(lgrp_snapshot_header_t *snap) in parent_orphans() argument
154 if (snap == NULL || snap->ss_info == NULL || in parent_orphans()
155 snap->ss_parents == NULL || snap->ss_root < 0 || in parent_orphans()
156 snap->ss_root >= snap->ss_nlgrps_max) in parent_orphans()
159 nlgrpsmax = snap->ss_nlgrps_max; in parent_orphans()
160 root = &snap->ss_info[snap->ss_root]; in parent_orphans()
168 if (i == snap->ss_root) in parent_orphans()
171 lgrp_info = &snap->ss_info[i]; in parent_orphans()
180 (ulong_t *)((uintptr_t)snap->ss_parents + in parent_orphans()
213 prune_child(lgrp_snapshot_header_t *snap, lgrp_id_t lgrp) in prune_child() argument
219 if (snap == NULL || lgrp < 0 || lgrp > snap->ss_nlgrps_max) in prune_child()
222 lgrp_info = &snap->ss_info[lgrp]; in prune_child()
231 for (i = 0; i < snap->ss_nlgrps_max; i++) { in prune_child()
233 lgrp_info = &snap->ss_info[i]; in prune_child()
243 prune_cpus(lgrp_snapshot_header_t *snap, lgrp_id_t lgrp, processorid_t *cpus, in prune_cpus() argument
254 if (snap == NULL || lgrp < 0 || lgrp > snap->ss_nlgrps_max) in prune_cpus()
257 lgrp_info = &snap->ss_info[lgrp]; in prune_cpus()
311 prune_tree(lgrp_snapshot_header_t *snap) in prune_tree() argument
320 if (snap == NULL || snap->ss_info == NULL) in prune_tree()
341 nlgrps_max = snap->ss_nlgrps_max; in prune_tree()
343 lgrp_info = &snap->ss_info[i]; in prune_tree()
344 if (BT_TEST(snap->ss_lgrpset, i)) in prune_tree()
345 prune_cpus(snap, i, cpus, ncpus); in prune_tree()
347 prune_cpus(snap, i, NULL, -1); in prune_tree()
359 lgrp_info = &snap->ss_info[i]; in prune_tree()
363 BT_SET(snap->ss_lgrpset, i); in prune_tree()
371 lgrp_info = &snap->ss_info[i]; in prune_tree()
375 ncpus = lgrp_cpus_hier(snap, i, NULL, NULL); in prune_tree()
376 nbytes = lgrp_mem_size((lgrp_cookie_t)snap, i, in prune_tree()
379 BT_CLEAR(snap->ss_lgrpset, i); in prune_tree()
380 prune_child(snap, i); in prune_tree()
381 snap->ss_nlgrps--; in prune_tree()
398 lgrp_snapshot_header_t *snap; in lgrp_init() local
411 snap = NULL; in lgrp_init()
412 while (snap == NULL) { in lgrp_init()
426 snap = NULL; in lgrp_init()
433 snap = malloc(bufsize); in lgrp_init()
434 if (snap == NULL) in lgrp_init()
436 bzero(snap, bufsize); in lgrp_init()
441 bufsize = lgrp_snapshot(snap, bufsize); in lgrp_init()
443 free(snap); in lgrp_init()
447 snap = NULL; in lgrp_init()
457 free(snap); in lgrp_init()
458 snap = NULL; in lgrp_init()
464 snap->ss_gen = gen; in lgrp_init()
465 snap->ss_view = view; in lgrp_init()
470 snap->ss_pset = 0; in lgrp_init()
477 snap->ss_pset = pset; in lgrp_init()
484 if (snap->ss_levels > 1) in lgrp_init()
485 (void) parent_orphans(snap); in lgrp_init()
491 (void) prune_tree(snap); in lgrp_init()
497 for (i = 0; i < snap->ss_nlgrps_max; i++) { in lgrp_init()
500 lgrp_info = &snap->ss_info[i]; in lgrp_init()
504 BT_SET(snap->ss_lgrpset, i); in lgrp_init()
508 return ((uintptr_t)snap); in lgrp_init()
519 lgrp_snapshot_header_t *snap; in lgrp_cookie_stale() local
524 snap = (lgrp_snapshot_header_t *)cookie; in lgrp_cookie_stale()
525 if (snap == NULL || snap->ss_magic != cookie) { in lgrp_cookie_stale()
534 if (snap->ss_gen != lgrp_generation(snap->ss_view)) in lgrp_cookie_stale()
540 if (snap->ss_view == LGRP_VIEW_CALLER) { in lgrp_cookie_stale()
543 if (snap->ss_pset != pset) in lgrp_cookie_stale()
557 lgrp_snapshot_header_t *snap; in lgrp_view() local
559 snap = (lgrp_snapshot_header_t *)cookie; in lgrp_view()
560 if (snap == NULL || snap->ss_magic != cookie) { in lgrp_view()
565 return (snap->ss_view); in lgrp_view()
575 lgrp_snapshot_header_t *snap; in lgrp_nlgrps() local
577 snap = (lgrp_snapshot_header_t *)cookie; in lgrp_nlgrps()
579 if (snap == NULL || snap->ss_magic != cookie) { in lgrp_nlgrps()
584 return (snap->ss_nlgrps); in lgrp_nlgrps()
594 lgrp_snapshot_header_t *snap; in lgrp_root() local
596 snap = (lgrp_snapshot_header_t *)cookie; in lgrp_root()
598 if (snap == NULL || snap->ss_magic != cookie) { in lgrp_root()
603 return (snap->ss_root); in lgrp_root()
616 lgrp_snapshot_header_t *snap; in lgrp_parents() local
620 snap = (lgrp_snapshot_header_t *)cookie; in lgrp_parents()
625 if (snap == NULL || snap->ss_magic != cookie || in lgrp_parents()
634 nlgrps_max = snap->ss_nlgrps_max; in lgrp_parents()
635 if (lgrp >= nlgrps_max || !BT_TEST(snap->ss_lgrpset, lgrp)) { in lgrp_parents()
644 if (lgrp == snap->ss_root || snap->ss_levels == 1) { in lgrp_parents()
653 if (snap->ss_parents == NULL) { in lgrp_parents()
661 lgrp_parents = &snap->ss_parents[lgrp * BT_BITOUL(nlgrps_max)]; in lgrp_parents()
695 lgrp_snapshot_header_t *snap; in lgrp_children() local
697 snap = (lgrp_snapshot_header_t *)cookie; in lgrp_children()
702 if (snap == NULL || snap->ss_magic != cookie || in lgrp_children()
711 nlgrps_max = snap->ss_nlgrps_max; in lgrp_children()
712 if (lgrp >= nlgrps_max || !BT_TEST(snap->ss_lgrpset, lgrp)) { in lgrp_children()
720 if (snap->ss_levels == 1) { in lgrp_children()
729 if (snap->ss_children == NULL) { in lgrp_children()
737 lgrp_children = &snap->ss_children[lgrp * BT_BITOUL(nlgrps_max)]; in lgrp_children()
762 lgrp_cpus_hier(lgrp_snapshot_header_t *snap, lgrp_id_t lgrp, in lgrp_cpus_hier() argument
777 lgrp_info = &snap->ss_info[lgrp]; in lgrp_cpus_hier()
790 nlgrps_max = snap->ss_nlgrps_max; in lgrp_cpus_hier()
801 lgrp_info = &snap->ss_info[i]; in lgrp_cpus_hier()
841 lgrp_snapshot_header_t *snap; in lgrp_cpus() local
843 snap = (lgrp_snapshot_header_t *)cookie; in lgrp_cpus()
848 if (snap == NULL || snap->ss_magic != cookie || in lgrp_cpus()
859 if (lgrp >= snap->ss_nlgrps_max || snap->ss_info == NULL || in lgrp_cpus()
860 !BT_TEST(snap->ss_lgrpset, lgrp)) { in lgrp_cpus()
868 lgrp_info = &snap->ss_info[lgrp]; in lgrp_cpus()
898 return (lgrp_cpus_hier(snap, lgrp, &cpuids, &count)); in lgrp_cpus()
920 lgrp_snapshot_header_t *snap; in lgrp_mem_size() local
922 snap = (lgrp_snapshot_header_t *)cookie; in lgrp_mem_size()
927 if (snap == NULL || snap->ss_magic != cookie || in lgrp_mem_size()
936 nlgrps_max = snap->ss_nlgrps_max; in lgrp_mem_size()
937 if (lgrp >= nlgrps_max || snap->ss_info == NULL || in lgrp_mem_size()
938 !BT_TEST(snap->ss_lgrpset, lgrp)) { in lgrp_mem_size()
948 lgrp_info = &snap->ss_info[lgrp]; in lgrp_mem_size()
991 lgrp_info = &snap->ss_info[i]; in lgrp_mem_size()
1029 lgrp_snapshot_header_t *snap; in lgrp_resources() local
1031 snap = (lgrp_snapshot_header_t *)cookie; in lgrp_resources()
1036 if (snap == NULL || snap->ss_magic != cookie || in lgrp_resources()
1046 nlgrps_max = snap->ss_nlgrps_max; in lgrp_resources()
1047 if (lgrp >= nlgrps_max || snap->ss_info == NULL || in lgrp_resources()
1048 !BT_TEST(snap->ss_lgrpset, lgrp)) { in lgrp_resources()
1056 lgrp_info = &snap->ss_info[lgrp]; in lgrp_resources()
1064 for (i = 0; i < snap->ss_nlgrps_max; i++) in lgrp_resources()
1081 lgrp_snapshot_header_t *snap; in lgrp_fini() local
1083 snap = (lgrp_snapshot_header_t *)cookie; in lgrp_fini()
1085 if (snap == NULL || snap->ss_magic != cookie) { in lgrp_fini()
1090 bzero(snap, snap->ss_size); in lgrp_fini()
1091 free(snap); in lgrp_fini()
1092 snap = NULL; in lgrp_fini()
1138 lgrp_snapshot_header_t *snap; in lgrp_latency_cookie() local
1140 snap = (lgrp_snapshot_header_t *)cookie; in lgrp_latency_cookie()
1145 if (snap == NULL || snap->ss_magic != cookie || from < 0 || to < 0 || in lgrp_latency_cookie()
1154 nlgrps_max = snap->ss_nlgrps_max; in lgrp_latency_cookie()
1182 lgrp_info = &snap->ss_info[from]; in lgrp_latency_cookie()
1186 return (snap->ss_latencies[from][to]); in lgrp_latency_cookie()