From 69ade9e07e2b1f2e155beb61c869d7032e2ecc37 Mon Sep 17 00:00:00 2001 From: sageweil Date: Fri, 24 Aug 2007 16:36:13 +0000 Subject: [PATCH] asdf git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1670 29311d96-e01e-0410-9327-a35deaab8ce9 --- trunk/ceph/script/convert_soe_trace.pl | 39 ++++++++++++++++++++++++++ trunk/ceph/script/merge_cdfs.pl | 24 ++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100755 trunk/ceph/script/convert_soe_trace.pl create mode 100755 trunk/ceph/script/merge_cdfs.pl diff --git a/trunk/ceph/script/convert_soe_trace.pl b/trunk/ceph/script/convert_soe_trace.pl new file mode 100755 index 0000000000000..a6ec80312d0fe --- /dev/null +++ b/trunk/ceph/script/convert_soe_trace.pl @@ -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 index 0000000000000..98c22764fc8b3 --- /dev/null +++ b/trunk/ceph/script/merge_cdfs.pl @@ -0,0 +1,24 @@ +#!/usr/bin/perl + +my %rows; # val -> [ count1, count2, ... ] + +my $filen = 0; +for my $file (@ARGV) { + open(I,"$file"); + while () { + 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"; +} -- 2.39.5