@@ -25,37 +25,27 @@ occurrences information.
25
25
$ odoc link -I . main__C. odoc
26
26
$ odoc link -I . main__. odoc
27
27
28
- $ odoc html-generate -o html main. odocl
29
- $ odoc html-generate -o html main__A. odocl
30
- $ odoc html-generate -o html main__B. odocl
31
- $ odoc html-generate -o html main__C. odocl
32
- $ odoc html-generate -o html main__. odocl
33
-
34
28
The count occurrences command outputs a marshalled hashtable, whose keys are
35
29
odoc identifiers, and whose values are integers corresponding to the number of
36
30
uses. We can later aggregate those hashtables, so we create the full hashtable,
37
31
and a hashtable for each compilation unit.
38
32
39
- $ mkdir dir1
40
- $ mkdir dir2
41
- $ mkdir dir3
42
- $ mkdir dir4
43
- $ mkdir dir5
44
-
45
- $ mv main. odocl dir1
46
- $ mv main__. odocl dir2
47
- $ mv main__A. odocl dir3
48
- $ mv main__B. odocl dir4
49
- $ mv main__C. odocl dir5
50
- $ odoc count-occurrences -I . -o occurrences. txt
51
- $ odoc count-occurrences -I dir1 -o occurrences1. txt
52
- $ odoc count-occurrences -I dir2 -o occurrences2. txt
53
- $ odoc count-occurrences -I dir3 -o occurrences3. txt
54
- $ odoc count-occurrences -I dir4 -o occurrences4. txt
55
- $ odoc count-occurrences -I dir5 -o occurrences5. txt
56
-
57
- $ du -h occurrences. txt
58
- 4.0 K occurrences. txt
33
+ $ mkdir main
34
+ $ mkdir main__
35
+ $ mkdir main__A
36
+ $ mkdir main__B
37
+ $ mkdir main__C
38
+
39
+ $ mv main. odocl main
40
+ $ mv main__. odocl main__
41
+ $ mv main__A. odocl main__A
42
+ $ mv main__B. odocl main__B
43
+ $ mv main__C. odocl main__C
44
+ $ odoc count-occurrences -I main -o main. occ
45
+ $ odoc count-occurrences -I main__ -o main__. occ
46
+ $ odoc count-occurrences -I main__A -o main__A. occ
47
+ $ odoc count-occurrences -I main__B -o main__B. occ
48
+ $ odoc count-occurrences -I main__C -o main__C. occ
59
49
60
50
The occurrences_print executable, available only for testing, unmarshal the file
61
51
and prints the number of occurrences in a readable format.
@@ -66,54 +56,85 @@ Uses of C are not counted, since the canonical destination (Main.C, generated by
66
56
Uses of B. Z are not counted since they go to a hidden module.
67
57
Uses of values Y. x and Z . y (in b. ml) are not counted since they come from a " local" module.
68
58
69
- $ occurrences_print occurrences. txt | sort
70
- Main was used directly 0 times and indirectly 13 times
71
- Main. A was used directly 4 times and indirectly 8 times
72
- Main. A. (|| > ) was used directly 1 times and indirectly 0 times
73
- Main. A. M was used directly 2 times and indirectly 0 times
74
- Main. A. t was used directly 1 times and indirectly 0 times
75
- Main. A. x was used directly 4 times and indirectly 0 times
76
- Main. B was used directly 1 times and indirectly 0 times
59
+ $ occurrences_print main. occ | sort
60
+
61
+ $ occurrences_print main__. occ | sort
62
+
63
+ $ occurrences_print main__A. occ | sort
77
64
string was used directly 1 times and indirectly 0 times
78
65
79
- $ occurrences_print occurrences1. txt | sort
66
+ $ occurrences_print main__B. occ | sort
67
+ Main was used directly 0 times and indirectly 1 times
68
+ Main. A was used directly 0 times and indirectly 1 times
69
+ Main. A. x was used directly 1 times and indirectly 0 times
70
+
71
+ $ occurrences_print main__C. occ | sort
72
+ Main was used directly 0 times and indirectly 1 times
73
+ Main. A was used directly 0 times and indirectly 1 times
74
+ Main. A. x was used directly 1 times and indirectly 0 times
75
+
76
+ Now we can merge both files
77
+
78
+ $ cat > files. map << EOF
79
+ > main__A. occ
80
+ > main__B. occ
81
+ > main__C. occ
82
+ > EOF
83
+ $ odoc aggregate-occurrences main. occ main__. occ -- file-list files. map -o aggregated. txt
84
+
85
+ $ occurrences_print aggregated. txt | sort
80
86
Main was used directly 0 times and indirectly 2 times
81
- Main. A was used directly 1 times and indirectly 0 times
82
- Main. B was used directly 1 times and indirectly 0 times
87
+ Main. A was used directly 0 times and indirectly 2 times
88
+ Main. A. x was used directly 2 times and indirectly 0 times
89
+ string was used directly 1 times and indirectly 0 times
83
90
84
- $ occurrences_print occurrences2 . txt | sort
91
+ Compare with the one created directly with all occurrences :
85
92
86
- $ occurrences_print occurrences3. txt | sort
93
+ $ odoc count-occurrences -I . -o occurrences. txt
94
+ $ occurrences_print occurrences. txt | sort
95
+ Main was used directly 0 times and indirectly 2 times
96
+ Main. A was used directly 0 times and indirectly 2 times
97
+ Main. A. x was used directly 2 times and indirectly 0 times
87
98
string was used directly 1 times and indirectly 0 times
88
99
89
- $ occurrences_print occurrences4. txt | sort
90
- Main was used directly 0 times and indirectly 8 times
91
- Main. A was used directly 2 times and indirectly 6 times
100
+ We can also include persistent ids, and hidden ids:
101
+
102
+ $ odoc count-occurrences -I . -o occurrences. txt -- include-persistent
103
+ $ occurrences_print occurrences. txt | sort
104
+ Main was used directly 0 times and indirectly 13 times
105
+ Main. A was used directly 4 times and indirectly 8 times
92
106
Main. A. (|| > ) was used directly 1 times and indirectly 0 times
93
107
Main. A. M was used directly 2 times and indirectly 0 times
94
108
Main. A. t was used directly 1 times and indirectly 0 times
95
- Main. A. x was used directly 2 times and indirectly 0 times
109
+ Main. A. x was used directly 4 times and indirectly 0 times
110
+ Main. B was used directly 1 times and indirectly 0 times
111
+ string was used directly 1 times and indirectly 0 times
96
112
97
- $ occurrences_print occurrences5. txt | sort
98
- Main was used directly 0 times and indirectly 3 times
99
- Main. A was used directly 1 times and indirectly 2 times
113
+ $ odoc count-occurrences -I . -o occurrences. txt -- include-hidden
114
+ $ occurrences_print occurrences. txt | sort
115
+ Main was used directly 0 times and indirectly 2 times
116
+ Main. A was used directly 0 times and indirectly 2 times
100
117
Main. A. x was used directly 2 times and indirectly 0 times
118
+ Main__B was used directly 0 times and indirectly 1 times
119
+ Main__B. Z was used directly 0 times and indirectly 1 times
120
+ Main__B. Z . y was used directly 1 times and indirectly 0 times
121
+ string was used directly 1 times and indirectly 0 times
101
122
102
- Now we can merge both files
103
-
104
- $ cat > files. map << EOF
105
- > occurrences3. txt
106
- > occurrences4. txt
107
- > occurrences5. txt
108
- > EOF
109
- $ odoc aggregate-occurrences occurrences1. txt occurrences2. txt -- file-list files. map -o aggregated. txt
110
-
111
- $ occurrences_print aggregated. txt | sort
123
+ $ odoc count-occurrences -I . -o occurrences. txt -- include-persistent -- include-hidden
124
+ $ occurrences_print occurrences. txt | sort
112
125
Main was used directly 0 times and indirectly 13 times
113
126
Main. A was used directly 4 times and indirectly 8 times
114
127
Main. A. (|| > ) was used directly 1 times and indirectly 0 times
115
128
Main. A. M was used directly 2 times and indirectly 0 times
116
129
Main. A. t was used directly 1 times and indirectly 0 times
117
130
Main. A. x was used directly 4 times and indirectly 0 times
118
131
Main. B was used directly 1 times and indirectly 0 times
132
+ Main__ was used directly 0 times and indirectly 2 times
133
+ Main__. C was used directly 1 times and indirectly 1 times
134
+ Main__. C. y was used directly 1 times and indirectly 0 times
135
+ Main__A was used directly 1 times and indirectly 0 times
136
+ Main__B was used directly 1 times and indirectly 1 times
137
+ Main__B. Z was used directly 0 times and indirectly 1 times
138
+ Main__B. Z . y was used directly 1 times and indirectly 0 times
139
+ Main__C was used directly 1 times and indirectly 0 times
119
140
string was used directly 1 times and indirectly 0 times
0 commit comments