]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
asdf
authorsageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Fri, 24 Aug 2007 16:36:13 +0000 (16:36 +0000)
committersageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Fri, 24 Aug 2007 16:36:13 +0000 (16:36 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1670 29311d96-e01e-0410-9327-a35deaab8ce9

trunk/ceph/script/convert_soe_trace.pl [new file with mode: 0755]
trunk/ceph/script/merge_cdfs.pl [new file with mode: 0755]

diff --git a/trunk/ceph/script/convert_soe_trace.pl b/trunk/ceph/script/convert_soe_trace.pl
new file mode 100755 (executable)
index 0000000..a6ec803
--- /dev/null
@@ -0,0 +1,39 @@
+#!/usr/bin/perl
+
+# this reads in one of kristal's anonymized static traces from
+# soe and makes it look like output from
+#
+#   find . -exec ls -dilsn --time-style=+%s \{\} \;
+#
+# (which is what SyntheticClient likes to "import", and
+#  study_static.pl likes to analyze for hardlinks, dirsizes, etc.)
+
+while (<>) {
+    chomp;
+    my ($file, $ino, $size, $actime, $ctime, $mtime, $uid, $gid, $omode, $nlink) = split(/ /,substr($_,1));
+    $file = '.' . $file;
+    my $nmode = oct($omode);
+    my $mode = '-...';
+    $mode = 'd...' if (($nmode & 0170000) == 0040000);
+    $mode = 'f...' if (($nmode & 0170000) == 0100000);
+    $size = hex($size);
+    $mtime = hex($mtime);
+    $uid = hex($uid);
+    $gid = hex($gid);
+    print "$ino ? $mode ? $nlink $uid $gid $size $mtime $file\n";
+}
+
+__END__
+
+soe format is
+0. a space
+1. full path of file name (MD5-ed and in base 64)
+2. inode number
+3. size of file in bytes (hex)
+4. atime (hex)
+5. ctime (hex)
+6. mtime (hex)
+7. uid (hex)
+8. gid (hex)
+9. mode (octal)
+10. number of links
diff --git a/trunk/ceph/script/merge_cdfs.pl b/trunk/ceph/script/merge_cdfs.pl
new file mode 100755 (executable)
index 0000000..98c2276
--- /dev/null
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+
+my %rows;  # val -> [ count1, count2, ... ]
+
+my $filen = 0;
+for my $file (@ARGV) {
+    open(I,"$file");
+    while (<I>) {
+       next if /^\#/;
+       chomp;
+       my ($v, $c) = split(/\t/,$_);
+       $rows{$v}->[$filen] = $c;
+    }
+    $filen++;
+}
+
+for my $v (sort {$a <=> $b} keys %rows) {
+    print "$v";
+    for (my $i=0; $i < $filen; $i++) {
+       print "\t" . int($rows{$v}->[$i]);
+    }
+    print "\n";
+    #print join("\t", $v, @{$rows{$v}}) . "\n";
+}