-
Notifications
You must be signed in to change notification settings - Fork 1
/
stats.sh
executable file
·242 lines (191 loc) · 4.63 KB
/
stats.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
#!/bin/sh
#
# libplayer statistics script - (c) 2008 Mathieu Schroeter
ECHO=echo
[ -f /bin/echo ] && ECHO=/bin/echo
bargraph ()
{
local PERCENT J I
PERCENT=$1
J=44
I=$((PERCENT * J / 100))
BARGRAPH=""
while [ $J -ne 0 ]
do
if [ $I -ne 0 ]; then
BARGRAPH="$BARGRAPH#"
I=$((I - 1))
else
BARGRAPH="${BARGRAPH}."
fi
J=$((J - 1))
done
}
varlist ()
{
local VAR I PRE NEWLINE
VAR=$1
I=0
NEWLINE=""
PRE=""
LIST=""
for x in $VAR
do
I=$((I + 1))
if [ "$I" = "6" ]; then
LIST="$LIST$PRE$x"
NEWLINE=",\n\t\t\t\t"
PRE=""
I=0
else
LIST="$LIST$NEWLINE$PRE$x"
NEWLINE=""
PRE=", "
fi
done
}
imp_functions ()
{
local NAME TOTAL NB_NULL PERCENT I J BARGRAPH
NAME=$1
TOTAL=$2
NB_OK=`grep -h -c "funcs->.*$NAME.*" $wrapper`
NB_NOT_SUPPORTED=`grep -h -c "funcs->.*PL_NOT_SUPPORTED.*" $wrapper`
TOTAL=$((TOTAL - NB_NOT_SUPPORTED))
NB_NULL=$((TOTAL - NB_OK))
PERCENT=$((NB_OK * 100 / TOTAL))
bargraph $PERCENT
$ECHO -e " $NAME\t: ($NB_OK)\t$PERCENT% \t[$BARGRAPH]"
}
sup_output ()
{
local NAME LIST TYPE TOTAL PERCENT PATTERN I VAR
TYPE=$1
NAME=$2
TOTAL=$3
PATTERN=$4
VAR=`grep PLAYER_${TYPE}_ $wrapper | grep -v "/\*.*PLAYER_$TYPE" | sed "s%$PATTERN%\1%" | sort -u`
NB_OK=`echo $VAR | sed "s% %\n%g" | grep ".*" -c`
PERCENT=$((NB_OK * 100 / TOTAL))
varlist "$VAR"
$ECHO -e " $NAME\t: ($NB_OK)\t$PERCENT%\t$LIST"
}
sup_resource ()
{
local NAME LIST TOTAL PERCENT I PATTERN VAR
NAME=$1
TOTAL=$2
PATTERN=$3
VAR=`grep MRL_RESOURCE_ $wrapper | grep -v "/\*.*MRL_RESOURCE_" | sed "s%$PATTERN%\1%" | sort -u`
NB_OK=`echo $VAR | sed "s% %\n%g" | grep ".*" -c`
PERCENT=$((NB_OK * 100 / TOTAL))
varlist "$VAR"
$ECHO -e " $NAME\t: ($NB_OK)\t$PERCENT%\t$LIST"
}
$ECHO -e ""
$ECHO -e " libplayer-r`hg tip --template={rev}`\t\t\t\t\t\t\t`date +%Y"-"%m"-"%d`"
$ECHO -e ""
$ECHO -e " These statistics are not relevant. But you can see approximately which"
$ECHO -e " is the progress for every wrapper."
WRAPPER_LIST=`ls src/wrapper_*.c | grep -v dummy`
$ECHO -e ""
$ECHO -e ""
$ECHO -e " Implemented Functions:"
$ECHO -e " ~~~~~~~~~~~~~~~~~~~~~~"
$ECHO -e ""
TOTAL_FCT=`grep -h -c "funcs->" src/wrapper_dummy.c`
I=0
for wrapper in $WRAPPER_LIST;
do
NAME=`$ECHO -e $wrapper | sed "s%.*_\(.*\)\.c%\1%"`
imp_functions $NAME $TOTAL_FCT
eval TOTAL_$I=\$NB_OK
I=$((I + 1))
done
$ECHO -e ""
$ECHO -e " Maximum: $TOTAL_FCT"
$ECHO -e ""
$ECHO -e ""
$ECHO -e " Supported Audio Outputs:"
$ECHO -e " ~~~~~~~~~~~~~~~~~~~~~~~~"
$ECHO -e ""
TYPE=AO
PATTERN=".*PLAYER_${TYPE}_\([A-Z0-9_]*\).*"
TOTAL_AO=`grep PLAYER_${TYPE}_ src/player.h | sed "s%$PATTERN%\1%" | sort -u | grep ".*" -c`
I=0
for wrapper in $WRAPPER_LIST;
do
NAME=`$ECHO -e $wrapper | sed "s%.*_\(.*\)\.c%\1%"`
sup_output $TYPE $NAME $TOTAL_AO $PATTERN
eval TOT=\$TOTAL_$I
TOT=$((TOT + NB_OK))
eval TOTAL_$I=\$TOT
I=$((I + 1))
done
$ECHO -e ""
$ECHO -e " Maximum: $TOTAL_AO"
$ECHO -e ""
$ECHO -e ""
$ECHO -e " Supported Video Outputs:"
$ECHO -e " ~~~~~~~~~~~~~~~~~~~~~~~~"
$ECHO -e ""
TYPE=VO
PATTERN=".*PLAYER_${TYPE}_\([A-Z0-9_]*\).*"
TOTAL_VO=`grep PLAYER_${TYPE}_ src/player.h | sed "s%$PATTERN%\1%" | sort -u | grep ".*" -c`
I=0
for wrapper in $WRAPPER_LIST;
do
NAME=`$ECHO -e $wrapper | sed "s%.*_\(.*\)\.c%\1%"`
sup_output $TYPE $NAME $TOTAL_VO $PATTERN
eval TOT=\$TOTAL_$I
TOT=$((TOT + NB_OK))
eval TOTAL_$I=\$TOT
I=$((I + 1))
done
$ECHO -e ""
$ECHO -e " Maximum: $TOTAL_VO"
$ECHO -e ""
$ECHO -e ""
$ECHO -e " Supported Resources:"
$ECHO -e " ~~~~~~~~~~~~~~~~~~~~"
$ECHO -e ""
PATTERN=".*MRL_RESOURCE_\([A-Z0-9_]*\).*"
TOTAL_RES=`grep MRL_RESOURCE_ src/player.h | sed "s%$PATTERN%\1%" | sort -u | grep ".*" -c`
I=0
for wrapper in $WRAPPER_LIST;
do
NAME=`$ECHO -e $wrapper | sed "s%.*_\(.*\)\.c%\1%"`
sup_resource $NAME $TOTAL_RES $PATTERN
eval TOT=\$TOTAL_$I
TOT=$((TOT + NB_OK))
eval TOTAL_$I=\$TOT
I=$((I + 1))
done
$ECHO -e ""
$ECHO -e " Maximum: $TOTAL_RES"
$ECHO -e ""
$ECHO -e ""
$ECHO -e " Global statistics (sum):"
$ECHO -e " ~~~~~~~~~~~~~~~~~~~~~~~~"
$ECHO -e ""
TOTAL_W=0
TOTAL=$((TOTAL_FCT + TOTAL_AO + TOTAL_VO + TOTAL_RES))
I=0
for wrapper in $WRAPPER_LIST;
do
NAME=`$ECHO -e $wrapper | sed "s%.*_\(.*\)\.c%\1%"`
eval TOTAL_S=\$TOTAL_$I
TOTAL_W=$((TOTAL_W + TOTAL_S))
PERCENT=$((TOTAL_S * 100 / TOTAL))
bargraph $PERCENT
$ECHO -e " $NAME\t: ($TOTAL_S)\t$PERCENT% \t[$BARGRAPH]"
I=$((I + 1))
done
$ECHO -e ""
$ECHO -e " Maximum: $TOTAL"
PERCENT=$((TOTAL_W * 100 / (TOTAL * I)))
bargraph $PERCENT
$ECHO -e ""
$ECHO -e ""
$ECHO -e " libplayer\t:\t$PERCENT%\t[$BARGRAPH]"
$ECHO -e ""