aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/tools/hlrstat.pl
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-03-22 03:25:11 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-03-24 06:16:04 +0100
commit22481bf76d129d3c41d20b96b6587ef085be485b (patch)
tree8c8de852e945dd5422a83bc7e0c37548d2911fe2 /openbsc/tools/hlrstat.pl
parentb973955295b720b8ba7c556d0165750ed9bfb381 (diff)
parent61b4232c6363ff9d78ef73b9dbf47ec16c94d610 (diff)
Merge remote branch 'origin/master' into on-waves/bsc-master
* Move to libosmocore * Move to new debugging architecture * Register the BTS types * Has only been compile tested Conflicts: openbsc/include/openbsc/Makefile.am openbsc/include/openbsc/gsm_data.h openbsc/include/openbsc/ipaccess.h openbsc/include/openbsc/mgcp.h openbsc/include/openbsc/msgb.h openbsc/include/openbsc/tlv.h openbsc/src/Makefile.am openbsc/src/abis_rsl.c openbsc/src/bsc_init.c openbsc/src/bsc_mgcp.c openbsc/src/chan_alloc.c openbsc/src/debug.c openbsc/src/gsm_subscriber_base.c openbsc/src/msgb.c openbsc/src/rest_octets.c openbsc/src/sccp/sccp.c openbsc/src/vty/command.c openbsc/src/vty_interface.c openbsc/tests/Makefile.am
Diffstat (limited to 'openbsc/tools/hlrstat.pl')
-rwxr-xr-xopenbsc/tools/hlrstat.pl25
1 files changed, 20 insertions, 5 deletions
diff --git a/openbsc/tools/hlrstat.pl b/openbsc/tools/hlrstat.pl
index a3fd2b81e..668fc9a4a 100755
--- a/openbsc/tools/hlrstat.pl
+++ b/openbsc/tools/hlrstat.pl
@@ -8,6 +8,18 @@ my $dbh = DBI->connect("dbi:SQLite:dbname=hlr.sqlite3","","");
my %mcc_names;
my %mcc_mnc_names;
+sub get_mcc_mnc_name($)
+{
+ my $mcc_mnc = shift;
+ my $ret = $mcc_mnc;
+
+ if ($mcc_mnc_names{$mcc_mnc} ne '') {
+ $ret = $mcc_mnc_names{$mcc_mnc};
+ }
+
+ return $ret;
+}
+
sub read_networks($)
{
my $filename = shift;
@@ -37,6 +49,7 @@ read_networks("networks.tab");
my %oper_count;
my %country_count;
+#my $sth = $dbh->prepare("SELECT imsi FROM subscriber where authorized=1");
my $sth = $dbh->prepare("SELECT imsi FROM subscriber");
$sth->execute();
@@ -49,10 +62,12 @@ while (my $href = $sth->fetchrow_hashref) {
}
-foreach my $c (keys %country_count) {
+foreach my $c (sort{$country_count{$b} <=> $country_count{$a}} keys %country_count) {
printf("%s: %d\n", $mcc_names{$c}, $country_count{$c});
-}
- foreach my $k (keys %oper_count) {
- printf("\t%s: %d\n", $mcc_mnc_names{$k}, $oper_count{$k});
+
+ foreach my $k (sort{$oper_count{$b} <=> $oper_count{$a}} keys %oper_count) {
+ if ($k =~ /^$c-/) {
+ printf("\t%s: %d\n", get_mcc_mnc_name($k), $oper_count{$k});
+ }
}
-#//}
+}