Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Chart both total metadata size and size for only UK registered entities.
Browse files Browse the repository at this point in the history
  • Loading branch information
iay committed Jan 3, 2014
1 parent 8105742 commit d3686dc
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 16 deletions.
44 changes: 44 additions & 0 deletions charting/just_ours.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
just_ours.xsl
Remove SAML entities registered other than by the UK federation.
Leave in entities without registrationAuthority so that this still does
the right thing with older aggregates which don't have MDRPI metadata.
Author: Ian A. Young <ian@iay.org.uk>
-->
<xsl:stylesheet version="1.0"
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
xmlns:mdrpi="urn:oasis:names:tc:SAML:metadata:rpi"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!--
Force UTF-8 encoding for the output.
-->
<xsl:output omit-xml-declaration="no" method="xml" encoding="UTF-8"/>

<!--
Discard entities not registered by the UK federation.
-->
<xsl:template match="md:EntityDescriptor
[not(descendant::mdrpi:RegistrationInfo/@registrationAuthority='http://ukfederation.org.uk')]">
<!-- do nothing -->
</xsl:template>

<!--By default, copy text blocks, comments and attributes unchanged.-->
<xsl:template match="text()|comment()|@*">
<xsl:copy/>
</xsl:template>

<!--By default, copy all elements from the input to the output, along with their attributes and contents.-->
<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>
68 changes: 52 additions & 16 deletions charting/sizes.pl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
#
# sizes.pl
#
use lib "../build";
use File::stat;
use Xalan;
use Months;

# Parse command line arguments
Expand All @@ -20,44 +22,78 @@

# ingest files
foreach $month (@months) {
print "Processing $month\n";

#
# Process the archived file, representing all entities,
# including those imported from other federations.
#
my $fn = "cache/$month.xml";
my $stat = stat($fn);
my $all_size = $stat->size;
my $all_count = int(`grep '</Entity' $fn | wc -l`);
my $all_ratio = int($all_size/$all_count);
push @all_sizes, $all_size;
push @all_counts, $all_count;
push @all_ratios, $all_ratio;

#
# Now generate a reduced version of the archived
# file that contains only UK federation registered entities.
#
my $command = xalanCall . " -IN $fn -XSL just_ours.xsl -OUT temp.tmp";
# print "command is $command\n";
system($command); # || print "ignoring claimed failure in sub command\n";
# print "Xalan run on $fn\n";

#
# Process the reduced version of the archived file.
#
$fn = "temp.tmp";
$stat = stat($fn);
$size = $stat->size;
$wc = int(`grep '</Entity' $fn | wc -l`);
$ratio = int($size/$wc);
push @sizes, $size;
push @counts, $wc;
push @ratios, $ratio;
my $our_size = $stat->size;
my $our_count = int(`grep '</Entity' $fn | wc -l`);
my $our_ratio = int($our_size/$our_count);
push @our_sizes, $our_size;
push @our_counts, $our_count;
push @our_ratios, $our_ratio;
}

print "months\n";
foreach $month (@months) {
print "$month\n";
}

print "size\n";
foreach $size (@sizes) {
print "sizeM (all)\n";
foreach $size (@all_sizes) {
$size /= 1000000;
print "$size\n";
}

print "sizeM\n";
foreach $size (@sizes) {
print "sizeM (UK)\n";
foreach $size (@our_sizes) {
$size /= 1000000;
print "$size\n";
}

print "entities\n";
foreach $count (@counts) {
print "entities (all)\n";
foreach $count (@all_counts) {
print "$count\n";
}

print "ratio\n";
foreach $ratio (@ratios) {
print "entities (UK)\n";
foreach $count (@our_counts) {
print "$count\n";
}

print "ratioK (all)\n";
foreach $ratio (@all_ratios) {
$ratio /= 1000;
print "$ratio\n";
}

print "ratioK\n";
foreach $ratio (@ratios) {
print "ratioK (UK)\n";
foreach $ratio (@our_ratios) {
$ratio /= 1000;
print "$ratio\n";
}

0 comments on commit d3686dc

Please sign in to comment.