Lines Matching +full:sub +full:- +full:processor
28 # pginfo - tool for displaying Processor Group information
53 # 0 System 0-7
72 # 2 Invalid command-line options were specified.
91 my $do_cpulist; # -C - Show CPU IDs
92 my $do_cpus; # -c - Treat args as CPU IDs
93 my $do_physical; # -p - Show physical relationships
94 my $do_sharing_only; # -S - Only show sharing relationships
95 my $do_tree; # -T - Show ASCII tree
96 my $do_usage; # -h - Show usage
97 my $do_version; # -V - Show version
98 my $script_mode; # -I - Only show IDs
99 my $verbose = 0; # -v - Verbose output
100 my @sharing_filter; # -r string,...
101 my @sharing_filter_neg; # -R string,...
121 # Print usage message when -h is given
137 gettext("%s: options -I and -C can not be used at the same time\n"),
146 gettext("%s: options -C and -I can not be used with -p -s or -T\n"),
153 gettext("%s: option -p can not be used with -s\n"), $cmdname;
159 gettext("%s: option -T can not be used with -s\n"),
172 my $p = Sun::Solaris::Pg->new(-tags => $do_physical,
173 -retry => RETRY_COUNT,
174 '-delay' => RETRY_DELAY);
178 gettext("%s: can not obtain Processor Group information: $!\n"),
184 # Convert -[Rr] string1,string2,... into list (string1, string2, ...)
192 my @all_pgs = $p->all_depth_first();
196 gettext("%s: this system does not have any Processor groups\n"),
210 my @all_cpus = $p->cpus($p->root());
215 # Arguments can be specified as x-y x,y,z and use special keyword 'all'
225 # Expand any x-y,z ranges
226 @args = $p->expand(@args);
230 my @bad_cpus = $p->set_subtract(\@all_cpus, \@args);
233 gettext("%s: Invalid processor IDs %s\n"),
234 $cmdname, $p->id_collapse(@bad_cpus);
241 my @cpus = $p->cpus($_);
242 scalar($p->intersect(\@cpus, \@args));
246 @pgs = $p->intersect(\@all_pgs, \@args);
248 my @bad_pgs = $p->set_subtract(\@all_pgs, \@args);
252 $cmdname, $p->id_collapse(@bad_pgs);
260 # those matching -R
262 @pgs = grep { list_match($p->sh_name($_), @sharing_filter) } @pgs if
265 # Remove any that doesn't match -r
266 @pgs = grep { !list_match($p->sh_name($_), @sharing_filter_neg) } @pgs if
272 gettext("%s: no processor groups matching command line arguments %s\n"),
278 # Global list of PGs that should be excluded from the output - it is only used
284 list_match($p->sh_name($_), @sharing_filter_neg)
294 # -I is specified, print list of all PGs
307 # -C is specified, print list of all CPUs belonging to PGs
310 my @cpu_list = $p->uniqsort(map { $p->cpus($_) } @pgs);
328 my @levels = map { $p->level($_) } @pgs;
334 my $name = $p->sh_name ($pg) || "unknown";
335 my $level = $p->level($pg) || 0;
338 my $tags = $p->tags($pg);
342 my $length = length($name) + $level - $minlevel;
348 # -s - only print sharing relationships
351 my @relationships = $p->sharing_relationships(@pgs);
354 printf "%-${max_sharename_len}s %s\n",
357 my @pg_rel = grep { $p->sh_name($_) eq $rel }
359 my $pg_rel = $p->id_collapse (@pg_rel);
365 printf "%-${max_sharename_len}s", $rel;
368 my $pgs = $p->id_collapse (@pgs);
384 $header = sprintf "%-${max_pg_len}s %-${max_sharename_len}s" .
393 # specified with -R option
398 # Find top-level PGs
400 $pg_tree->{$_} && !defined($pg_tree->{$_}->{parent})
403 # Print each top-level node as ASCII tree
405 my $children = $pg_tree->{$pg}->{children};
407 @children = $p->intersect(\@children, \@pgs);
423 sub pg_print
427 my $sharing = $p->sh_name($pg);
429 my $tags = $p->tags($pg);
432 my $level = $p->level($pg) - $minlevel;
434 my $cpus = $p->cpus($pg);
435 printf "%-${max_pg_len}d %-${max_sharename_len}s", $pg, $sharing;
444 sub pg_showcpus
449 my @cpus = $p->cpus($pg);
452 my $cpu_string = $p->cpus($pg);
462 sub pg_print_node
467 my $sharing = $p->sh_name($pg);
469 my $tags = $p->tags($pg);
485 sub pg_print_tree
496 my $children = $pg_tree->{$pg}->{children};
498 @children = $p->intersect(\@children, \@pgs);
507 print $prefix ? "$bar" . "-- " : "";
515 "$childprefix$new_prefix", --$nchildren)
523 sub list_match
531 # Make a version of PG parent-children relationships from cookie
533 sub pg_make_tree
538 foreach my $pg ($p->all()) {
539 my @children = $p->children($pg);
540 $pg_tree->{$pg}->{parent} = $p->parent($pg);
541 $pg_tree->{$pg}->{children} = \@children;
551 sub pg_remove_from_tree
555 my $node = $pg_tree->{$pg};
558 my @children = @{$node->{children}};
559 my $parent = $node->{parent};
565 map { $pg_tree->{$_}->{parent} = $parent } @children;
570 if (defined($parent) && ($parent_node = $pg_tree->{$parent})) {
574 my @parent_children = @{$parent_node->{children}};
579 @parent_children = $p->nsort(@parent_children, @children);
580 $parent_node->{children} = \@parent_children;
584 delete $pg_tree->{$pg};
590 sub pg_lineage
595 my @parents = grep { defined($_) } map { $p->parent ($_) } @_;
597 return ($p->uniq(@_, @parents, pg_lineage ($p, @parents)));
603 sub usage
607 gettext("Usage:\t%s [-T] [-p] [-v] [-r string] [-R string] [pg ... | -c processor_id ...]\n\n"),
610 gettext("\t%s -s [-v] [-r string] [-R string] [pg ... | -c processor_id ...]\n\n"), $cmdname;
611 printf STDERR gettext("\t%s -C | -I [-r string] [-R string] [pg ... | -c processor_id ...]\n\n"),
613 printf STDERR gettext("\t%s -h\n\n"), $cmdname;