开发者

Count the number of labels in ClearCase

开发者 https://www.devze.com 2023-02-02 09:46 出处:网络
In my VOB there are a lot of labels (the type, not labels applied to a file).I want to find out how many there are but it is too many to count by hand.How c开发者_如何学Goan I get a count of how many

In my VOB there are a lot of labels (the type, not labels applied to a file). I want to find out how many there are but it is too many to count by hand. How c开发者_如何学Goan I get a count of how many label types I have?


This should work:

cleartool find /vobs/vobsname -kind lbtype -print | wc -l

It came up with the answer 12291 on one of the VOBs I work with (one that is over 15 years old).

Note that I've added -s to the lstype command - I got a misleading line count first time because of that. Here are some timing tests (ct is effectively an alias for cleartool that takes less typing - and causes occasional confusion with the 'call terminal' program on Unixes with archaic communications software still installed):

$ time ct find . -kind lbtype -print | wc -l
12291
   27.08s real     1.77s user     1.30s system
$ time ct lstype -kind lbtype -s -unsorted | sort | uniq -c |
>     tee /tmp/x1 | wc -l
12292
   58.10s real     4.96s user     4.66s system
$ time ct lstype -kind lbtype -s -unsorted | wc -l                      
12292
   94.97s real     4.48s user     4.52s system
$ time ct lstype -kind lbtype -s -unsorted | wc -l
12292
   73.66s real     4.69s user     4.91s system
$ time ct find . -kind lbtype -print | wc -l                            
12291
   25.39s real     2.19s user     1.53s system
$ 

Hmmm...very variable performance on the lstype; the performance of find is more consistent and quicker. YMMV!

I expect that someone added a label between runs.

I'm not sure how to assess the performance differences; the results seem to be the same.


Further timings on my machine (Linux x86/64):

$ time ct lstype -local -s -kind lbtype -invob /vobs/vobname -unsorted | wc -l
12292
   79.49s real     1.27s user     1.87s system
$ time ct lstype -local -s -kind lbtype -invob /vobs/vobname -unsorted | wc -l
12292
   36.87s real     1.39s user     1.79s system
$ time ct lstype -local -s -kind lbtype -invob /vobs/vobname -unsorted | wc -l
12292
   32.30s real     1.33s user     1.92s system
$ time ct find /vobs/vobname -kind lbtype -print | wc -l
12291
   21.68s real     0.81s user     0.67s system
$ time ct find /vobs/vobname -kind lbtype -print | wc -l
12291
   21.87s real     0.76s user     0.68s system
$ time ct lstype -local -s -kind lbtype -invob /vobs/vobname -unsorted | wc -l
12292
   32.94s real     1.26s user     1.78s system
$ 

All operations in the same view, with typing time only for the gap between 'ct lstype' and 'ct find' (otherwise, using history to re-execute). I'm not sure why there's the 12291 vs 12292 discrepancy.

$ ct -version
ClearCase version 7.0.1 (Wed May 30 17:04:58 EDT 2007)
7.0.1.0-RATL-RCC-IFIX01 (Wed Sep 19 16:08:10 EDT 2007)
7.0.1.1-RATL-RCC-RWP (Wed Dec 05 15:35:18 EST 2007)
7.0.1.1-RATL-RCC (Wed Dec 05 16:29:24 EST 2007)
7.0.1.1-RATL-RCC-IFIX02 (Tue May 13 14:43:13 EDT 2008)
7.0.1.2-RATL-RCC (Tue Jul 29 14:40:53 EDT 2008)
7.0.1.2-RATL-RCC-RWP (Tue Jul 29 17:31:59 EDT 2008)
7.0.1.3-RATL-RCC (Wed Nov 12 13:22:16 EST 2008)
7.0.1.4-RATL-RCC (Wed Feb 18 13:00:21 EST 2009)
@(#) MVFS version 7.0.1.4 (Tue Dec  9 00:34:57 2008) built at $Date: 2010-06-11.13:25:31 (UTC) $
cleartool                         7.0.1.4 (Wed Dec 10 00:55:12 EST 2008)
db_server                         7.0.1.4 (Tue Dec  9 01:09:22 EST 2008)
VOB database schema version: 54
$


Use lstype:

ct lstype -local -s -kind lbtype -invob \avob -unsorted

Then you can pipe the result to a wc to count the label types.

Don't forget the 'unsorted' parameter: the result will be quicker to be computed.

Jonathan Leffler's solution might be faster (not sure, wothout the -local for the lstype), but can't get all the labels (not the global ones, i.e. the ones from the hierarchy of adminvob).

The ct lstype above:

  • list only the local label types (remove the -local to list all label types)
  • don't necessitate a view with mounted vobs to operate
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号