From 3396c6a05c5372f7599bc8e627fd1a62a6cf23eb Mon Sep 17 00:00:00 2001 From: Philippe PITTOLI Date: Sun, 12 May 2024 16:47:53 +0200 Subject: [PATCH] Graphs! --- bin/extract-final-data.sh | 24 ++ bin/rsum2line.awk | 39 +++ bin/stats.sh | 66 ++++ bin/summary.r | 14 + .../.source-highlight_groff-output-definition | 71 +++++ graphs/Makefile | 5 + graphs/Makefile.in | 77 +++++ graphs/bibliography | 0 graphs/bin/ghighlight | 286 ++++++++++++++++++ graphs/bin/troffrc | 69 +++++ graphs/bin/utf8-to-ms.sh | 147 +++++++++ graphs/graphs.ms | 232 ++++++++++++++ 12 files changed, 1030 insertions(+) create mode 100755 bin/extract-final-data.sh create mode 100755 bin/rsum2line.awk create mode 100755 bin/stats.sh create mode 100644 bin/summary.r create mode 100644 graphs/.source-highlight_groff-output-definition create mode 100644 graphs/Makefile create mode 100644 graphs/Makefile.in create mode 100644 graphs/bibliography create mode 100755 graphs/bin/ghighlight create mode 100644 graphs/bin/troffrc create mode 100755 graphs/bin/utf8-to-ms.sh create mode 100644 graphs/graphs.ms diff --git a/bin/extract-final-data.sh b/bin/extract-final-data.sh new file mode 100755 index 0000000..697b2d6 --- /dev/null +++ b/bin/extract-final-data.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +if [ $# -ne 1 ] +then + echo "usage: $0 result-directory" + exit 0 +fi + +d=$1 + +echo "from data (.d) to truncated data (.t)" +for i in $d/*.d +do + fname=$(echo $i | sed "s/[.]d$/.t/") + awk '{ print $2, $3, $5 }' < $i > $fname +done + +awk '{ print $1 }' < $d/ram_index.d > it +mkdir data + +echo "from truncated data (.t) to graphed data data/XXX.d" +paste it $d/ram_index.t $d/cached_index.t $d/semi_index.t $d/uncached_index.t > ./data/index.d +paste it $d/ram_partitions.t $d/cached_partitions.t $d/semi_partitions.t $d/uncached_partitions.t > ./data/partitions.d +paste it $d/ram_tags.t $d/cached_tags.t $d/semi_tags.t $d/uncached_tags.t > ./data/tags.d diff --git a/bin/rsum2line.awk b/bin/rsum2line.awk new file mode 100755 index 0000000..e62528d --- /dev/null +++ b/bin/rsum2line.awk @@ -0,0 +1,39 @@ +#!/usr/bin/awk -f + +BEGIN { + FOUND_95pct = 0 + FOUND_mean = 0 +} + +FOUND_95pct == 1 { + pct_min = $1 + pct_max = $2 + FOUND_95pct = 0 +} + +FOUND_mean == 1 { + mean = $1 + print pct_min, median, mean, pct_max, t, df, pvalue + FOUND_mean = 0 +} + +/^t = / { + gsub(",", "", $3) + t = $3 + gsub(",", "", $6) + df = $6 + pvalue = $9 +} + +/mean of x/ { + FOUND_mean = 1 +} + +/Median/ { + gsub(":", "") + median = $2 +} + +/95 percent confidence/ { + FOUND_95pct = 1 +} diff --git a/bin/stats.sh b/bin/stats.sh new file mode 100755 index 0000000..c176365 --- /dev/null +++ b/bin/stats.sh @@ -0,0 +1,66 @@ +#!/bin/sh + +extract="./bin/extract-final-data.sh" +summary="./bin/summary.r" +summary_to_line="./bin/rsum2line.awk" + +if [ $# -ne 1 ] +then + echo "usage: $0 result-directory" + exit 0 +fi + +dir="$1" + +raw_to_summary() { + for i in $dir/*.raw + do + summary_with_bad_format=$(echo $i | sed "s/.raw$/.unconveniently_formated_summary/") + target=$(echo $i | sed "s/.raw$/.summary/") + if [ -f $summary_with_bad_format ]; then + echo -n "\r$summary_with_bad_format already exists: skipping " + else + Rscript $summary $i > $summary_with_bad_format + fi + if [ -f $target ]; then + echo -n "\r$target already exists: skipping " + else + $summary_to_line $summary_with_bad_format > $target + fi + done + echo "" + + # Beyond a certain number of entries, retrieving data from partitions and tags isn't tested anymore. + # This leads to create "fake entries" with a duration of 0, resulting to causing some problems with + # statistical analysis. So, we need to replace "NaN" by "0" in summaries. + sed -i "s/NaN/0/g" $dir/*.summary +} + +# List raw files with the number of iterations as a prefix so they can then be sorted. +sort_summary_files() { + for i in $dir/*.summary ; do f $i ; done | sort -n +} + +f() { + echo $* | sed "s/[_./]/ /g" | xargs echo "$* " | awk '{ printf "%s %s/%s_%s %s\n", $4, $2, $3, $5, $1 }' +} + +fill() { + while read LINE; do + nb_it=$(echo $LINE | awk '{ print $1 }') + target=$(echo $LINE | awk '{ print $2 }') + fname=$(echo $LINE | awk '{ print $3 }') + + cat $fname | xargs echo "$nb_it " >> $target.d + done +} + +raw_to_summary + +sort_summary_files | fill + +extract_final_data() { + $extract $dir +} + +extract_final_data diff --git a/bin/summary.r b/bin/summary.r new file mode 100644 index 0000000..a3f18a3 --- /dev/null +++ b/bin/summary.r @@ -0,0 +1,14 @@ +# Rscript summary handshake-duration.txt + +require(grDevices) # for colours + +tbl <- read.table(file=commandArgs(TRUE)[1]) +val <- tbl[1] + +summary(val) +# standarddeviation=sd(unlist(val)) +sd(unlist(val)) +# print (standarddeviation, zero.print="standard deviation: ") + +# confint.default (val) +t.test (val) diff --git a/graphs/.source-highlight_groff-output-definition b/graphs/.source-highlight_groff-output-definition new file mode 100644 index 0000000..b7adfd8 --- /dev/null +++ b/graphs/.source-highlight_groff-output-definition @@ -0,0 +1,71 @@ +extension "groff" +doctemplate +" +.MT 0 +$header +.TL +$title +.AU \"\" +.ND +.SA 0 +.DS I +" +".DE +$footer +" +end + +nodoctemplate +" +" +" +" +end + +bold "\f[CB]$text\fP" +italics "\f[CI]$text\fP" +underline "\f[CI]$text\fP" +fixed "\fC$text\fP" +color "\m[$style]$text\m[]" + +anchor "$infilename : $linenum - $text" +reference "$text \(-> $infile:$linenum, page : $infilename:$linenum" + +#lineprefix "\fC\(em\fP " +#lineprefix "\fC\n(ln\fP " + +lineprefix "" + + +colormap +"green" "green" +"red" "red" +"darkred" "darkred" +"blue" "blue" +"brown" "brown" +"pink" "pink" +"yellow" "yellow" +"cyan" "cyan" +"purple" "purple" +"orange" "orange" +"brightorange" "brightorange" +"brightgreen" "brightgreen" +"darkgreen" "darkgreen" +"black" "black" +"teal" "teal" +"gray" "gray" +"darkblue" "darkblue" +default "black" +end + +translations +"\\" "\\\\" +##"\n" " \\\\\n" +##" " "\\ " +##"\t" "\\ \\ \\ \\ \\ \\ \\ \\ " +"\t" " " +"|" "|" +"---" "\(em" +"--" "\(mi" +end + diff --git a/graphs/Makefile b/graphs/Makefile new file mode 100644 index 0000000..aaa6ef0 --- /dev/null +++ b/graphs/Makefile @@ -0,0 +1,5 @@ +SRC ?= graphs +ODIR ?= /tmp/ +export ODIR SRC + +include Makefile.in diff --git a/graphs/Makefile.in b/graphs/Makefile.in new file mode 100644 index 0000000..559d2be --- /dev/null +++ b/graphs/Makefile.in @@ -0,0 +1,77 @@ +SRC ?= graphs + +ODIR ?= . + +BIBLIOGRAPHY ?= bibliography +ALLSRC = $(shell find .) + +SOELIM_OPTS ?= +SOELIM = soelim $(SOELIM_OPTS) + +PRECONV_OPTS ?= -e utf-8 +PRECONV = preconv $(PRECONV_OPTS) + +EQN_OPTS ?= -Tpdf +EQN = eqn $(EQN_OPTS) + +# source-highlight stuff +# GH_INTRO: instructions before each source code provided by source-highlight +# GH_OUTRO: ------------ after ---- ------ ---- -------- -- ---------------- +# GH_INTRO/GH_OUTRO: values are separated by ';' +# +GH_INTRO := .b1;.nr DI 0;.DS I;.fam C +GH_OUTRO := .fam;.DE;.b2 +# +export GH_INTRO +export GH_OUTRO +# +# SHOPTS: cmd line parameter given to source-highlight +SHOPTS = --outlang-def=.source-highlight_groff-output-definition +export SHOPTS + +# ghighlight brings `source-highlight` to troff +GHIGHLIGHT_OPTS ?= +GHIGHLIGHT = ./bin/ghighlight $(GHIGHLIGHT_OPTS) + +GRAP_OPTS ?= +GRAP = grap $(GRAP_OPTS) + +PIC_OPTS ?= -Tpdf +PIC = pic $(PIC_OPTS) + +# -P => move ponctuation after reference +# -S => label and bracket-label options +# -e => accumulate (use a reference section) +# -p bib => bibliography file +REFER_OPTS ?= -PS -e -p $(BIBLIOGRAPHY) +REFER = refer $(REFER_OPTS) + +# -k => iconv conversion (did it ever worked?) +# -ms => ms macro +# -U => unsafe (because of PDF inclusion) +# -Tpdf => output device is PDF +# -mspdf => include PDF (so, images converted in PDF) in the document +# NOTE: a custom troffrc (configuration file) is necessary on OpenBSD +# to have correctly justified paragraphs. Otherwise, the default +# configuration removes this possibility, for bullshit reasons. Sad. +# -M dir => path to custom troffrc +# TODO: no change with or without the following options -P -e +# This has to be inverstigated: how to make PDFs look nice in browsers? +# -P -e => provide "-e" to gropdf to embed fonts +GROFF_OPTS ?= -ms -t -Tpdf -U -mspdf -mpdfmark -M ./bin -P -e +GROFF = groff $(GROFF_OPTS) + +$(SRC).pdf: + $(SOELIM) < $(SRC).ms |\ + $(PRECONV) |\ + $(EQN) |\ + $(GHIGHLIGHT) |\ + $(GRAP) |\ + $(PIC) |\ + $(REFER) |\ + $(GROFF) > $(ODIR)/$@ + +# Keep options in memory for the recursive 'make' call +export SOELIM_OPTS PRECONV_OPTS EQN_OPTS GHIGHLIGHT_OPTS GRAP_OPTS PIC_OPTS REFER_OPTS +serve: + find . -name "*.ms" -or -name "*.d" | entr gmake -B $(SRC).pdf diff --git a/graphs/bibliography b/graphs/bibliography new file mode 100644 index 0000000..e69de29 diff --git a/graphs/bin/ghighlight b/graphs/bin/ghighlight new file mode 100755 index 0000000..d3903d7 --- /dev/null +++ b/graphs/bin/ghighlight @@ -0,0 +1,286 @@ +#! /usr/bin/env perl + +# ghighlight - A simple preprocessor for adding code highlighting in a groff file + +# Copyright (C) 2014-2018 Free Software Foundation, Inc. + +# Written by Bernd Warken . + +my $version = '0.9.0'; + +# This file is part of 'ghighlight', which is part of 'groff'. + +# 'groff' is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. + +# 'groff' is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. + +# You can find a copy of the GNU General Public License in the internet +# at . + +######################################################################## + +use strict; +use warnings; +#use diagnostics; + +# current working directory +use Cwd; + +# $Bin is the directory where this script is located +use FindBin; + +# open3 for a bidirectional communication with a child process +use IPC::Open3; + + +######################################################################## +# system variables and exported variables +######################################################################## + +$\ = "\n"; # final part for print command + +######################################################################## +# read-only variables with double-@ construct +######################################################################## + +our $File_split_env_sh; +our $File_version_sh; +our $Groff_Version; + +my $before_make; # script before run of 'make' +{ + my $at = '@'; + $before_make = 1 if '@VERSION@' eq "${at}VERSION${at}"; +} + +my %at_at; +my $file_perl_test_pl; +my $groffer_libdir; + +if ($before_make) { + my $highlight_source_dir = $FindBin::Bin; + $at_at{'BINDIR'} = $highlight_source_dir; + $at_at{'G'} = ''; +} else { + $at_at{'BINDIR'} = '@BINDIR@'; + $at_at{'G'} = '@g@'; +} + + +######################################################################## +# options +######################################################################## + +foreach (@ARGV) { + if ( /^(-h|--h|--he|--hel|--help)$/ ) { + print q(Usage for the 'ghighlight' program:); + print 'ghighlight [-] [--] [filespec...] normal file name arguments'; + print 'ghighlight [-h|--help] gives usage information'; + print 'ghighlight [-v|--version] displays the version number'; + print q(This program is a 'groff' preprocessor that handles highlighting source code ) . + q(parts in 'roff' files.); + exit; + } elsif ( /^(-v|--v|--ve|--ver|--vers|--versi|--versio|--version)$/ ) { + print q('ghighlight' version ) . $version; + exit; + } +} + +my $macros = "groff_mm"; +if ( $ENV{'GHLENABLECOLOR'} ) { + $macros = "groff_mm_color"; +} +######################################################################## +# input +######################################################################## + +my $source_mode = 0; + +my @lines = (); + + +sub getTroffLine { + my ($opt) = @_; + if ($opt =~ /^ps=([0-9]+)/) {".ps $1"} + elsif ($opt =~ /^vs=(\S+)/) {".vs $1"} + else { print STDERR "didn't recognised '$opt'"; ""} +} + +sub getTroffLineOpposite { + my ($opt) = @_; + if ($opt =~ /^ps=/) {".ps"} + elsif ($opt =~ /^vs=/) {".vs"} + else { print STDERR "didn't recognised '$opt'"; ""} +} + +# language for codeblocks +my $lang = ''; +my @options = (); +foreach (<>) { + chomp; + s/\s+$//; + my $line = $_; + my $is_dot_Source = $line =~ /^[.']\s*(``|SOURCE)(|\s+.*)$/; + + unless ( $is_dot_Source ) { # not a '.SOURCE' line + if ( $source_mode ) { # is running in SOURCE mode + push @lines, $line; + } else { # normal line, not SOURCE-related + print $line; + } + next; + } + + + ########## + # now the line is a '.SOURCE' line + + my $args = $line; + $args =~ s/\s+$//; # remove final spaces + $args =~ s/^[.']\s*(``|SOURCE)\s*//; # omit .source part, leave the arguments + + my @args = split /\s+/, $args; + + ########## + # start SOURCE mode + + $lang = $args[0] if ( @args > 0 && $args[0] ne 'stop' ); + + if ( @args > 0 && $args[0] ne 'stop' ) { + # For '.``' no args or first arg 'start' means opening 'SOURCE' mode. + # Everything else means an ending command. + + shift @args; + @options = @args; + + if ( $source_mode ) { + # '.SOURCE' was started twice, ignore + print STDERR q('.``' starter was run several times); + next; + } else { # new SOURCE start + $source_mode = 1; + @lines = (); + next; + } + } + + ########## + # now the line must be a SOURCE ending line (stop) + + unless ( $source_mode ) { + print STDERR 'ghighlight.pl: there was a SOURCE ending without being in ' . + 'SOURCE mode:'; + print STDERR ' ' . $line; + next; + } + + $source_mode = 0; # 'SOURCE' stop calling is correct + + my $shopts = $ENV{"SHOPTS"} || ""; + + ########## + # Run source-highlight on lines + # Check if language was specified + my $cmdline = "source-highlight -f $macros $shopts --output STDOUT"; + if ($lang ne '') { + $cmdline .= " -s $lang"; + } + + # Start `source-highlight` + my $pid = open3(my $child_in, my $child_out, my $child_err, $cmdline) + or die "open3() failed $!"; + + # Provide source code to `source-highlight` in its standard input + print $child_in $_ for @lines; + close $child_in; + + if (my $v = $ENV{"GH_INTRO"}) { + print for split /;/, $v; + } + + for (@options) { + my $l = getTroffLine $_; + print $l if ($l ne ""); + } + + # Print `source-highlight` output + while (<$child_out>) { + chomp; + print; + } + close $child_out; + + for (reverse @options) { + my $l = getTroffLineOpposite $_; + print $l if ($l ne ""); + } + + if (my $v = $ENV{"GH_OUTRO"}) { + print for split /;/, $v; + } + + my @print_res = (1); + + # Start argument processing + + # remove 'stop' arg if exists + # shift @args if ( $args[0] eq 'stop' ); + + # if ( @args == 0 ) { + # # no args for saving, so @print_res doesn't matter + # next; + # } + # my @var_names = (); + # my @mode_names = (); + + # my $mode = '.ds'; + # for ( @args ) { + # if ( /^\.?ds$/ ) { + # $mode = '.ds'; + # next; + # } + # if ( /^\.?nr$/ ) { + # $mode = '.nr'; + # next; + # } + # push @mode_names, $mode; + # push @var_names, $_; + # } + + # my $n_vars = @var_names; + + # if ( $n_vars < $n_res ) { + # print STDERR 'ghighlight: not enough variables for Python part: ' . + # $n_vars . ' variables for ' . $n_res . ' output lines.'; + # } elsif ( $n_vars > $n_res ) { + # print STDERR 'ghighlight: too many variablenames for Python part: ' . + # $n_vars . ' variables for ' . $n_res . ' output lines.'; + # } + # if ( $n_vars < $n_res ) { + # print STDERR 'ghighlight: not enough variables for Python part: ' . + # $n_vars . ' variables for ' . $n_res . ' output lines.'; + # } + + # my $n_min = $n_res; + # $n_min = $n_vars if ( $n_vars < $n_res ); + # exit unless ( $n_min ); + # $n_min -= 1; # for starting with 0 + + # for my $i ( 0..$n_min ) { + # my $value = $print_res[$i]; + # chomp $value; + # print $mode_names[$i] . ' ' . $var_names[$i] . ' ' . $value; + # } +} + + +1; +# Local Variables: +# mode: CPerl +# End: diff --git a/graphs/bin/troffrc b/graphs/bin/troffrc new file mode 100644 index 0000000..8624241 --- /dev/null +++ b/graphs/bin/troffrc @@ -0,0 +1,69 @@ +.\" Startup file for troff. +. +.\" This is tested by pic. +.nr 0p 0 +. +.\" Load composite mappings. +.do mso composite.tmac +. +.\" Load generic fallback mappings. +.do mso fallbacks.tmac +. +.\" Use .do here, so that it works with -C. +.\" The groff command defines the .X string if the -X option was given. +.ie r.X .do ds troffrc!ps Xps.tmac +.el .do ds troffrc!ps ps.tmac +.do ds troffrc!pdf pdf.tmac +.do ds troffrc!dvi dvi.tmac +.do ds troffrc!X75 X.tmac +.do ds troffrc!X75-12 X.tmac +.do ds troffrc!X100 X.tmac +.do ds troffrc!X100-12 X.tmac +.do ds troffrc!ascii tty.tmac +.do ds troffrc!latin1 tty.tmac +.do ds troffrc!utf8 tty.tmac +.do ds troffrc!cp1047 tty.tmac +.do ds troffrc!lj4 lj4.tmac +.do ds troffrc!lbp lbp.tmac +.do ds troffrc!html html.tmac +.do if d troffrc!\*[.T] \ +. do mso \*[troffrc!\*[.T]] +.do rm troffrc!ps troffrc!Xps troffrc!dvi troffrc!X75 troffrc!X75-12 \ +troffrc!X100 troffrc!X100-12 troffrc!lj4 troff!lbp troffrc!html troffrc!pdf +. +.\" Test whether we work under EBCDIC and map the no-breakable space +.\" character accordingly. +.do ie '\[char97]'a' \ +. do tr \[char160]\~ +.el \ +. do tr \[char65]\~ +. +.\" Set the hyphenation language to 'us'. +.do hla us +. +.\" Disable hyphenation: +.\" Do not load hyphenation patterns and exceptions. +.\"do hpf hyphen.us +.\"do hpfa hyphenex.us +. +.\" Disable adjustment by default, +.\" such that manuals look similar with groff and mandoc(1). +.\".ad l +.\".de ad +.\".. +.\" Handle paper formats. +.do mso papersize.tmac +. +.\" Handle PS images. +.do mso pspic.tmac +.do mso pdfpic.tmac +. +.\" ==================================================================== +.\" Editor settings +.\" ==================================================================== +. +.\" Local Variables: +.\" mode: nroff +.\" fill-column: 72 +.\" End: +.\" vim: set filetype=groff textwidth=72: diff --git a/graphs/bin/utf8-to-ms.sh b/graphs/bin/utf8-to-ms.sh new file mode 100755 index 0000000..70337db --- /dev/null +++ b/graphs/bin/utf8-to-ms.sh @@ -0,0 +1,147 @@ +#!/bin/sh + +# This program isn't by any mean complete. +# Most of text markers, accents and ligatures are handled. +# However, nothing else currently is. +# Please, do provide more translations. + +# Convert input into hexadecimal and a single byte per line. +to_hex_one_column() xxd -p -c 1 + +# Reverse hexadecimal to original value. +from_hex() xxd -p -r + +regroup_lines() awk ' + BEGIN { + line_start=1 + } + + { + if (line_start == 1) + line = $1; + else + line = line " " $1; + + line_start = 0; + if ($1 == "0a") { + print line; + line_start = 1 + } + } + + END { + if (line_start == 0) + print line + } + ' + +accents() sed \ + -e "s/c3 81/5c 5b 27 41 5d/g"\ + -e "s/c3 89/5c 5b 27 45 5d/g"\ + -e "s/c3 8d/5c 5b 27 49 5d/g"\ + -e "s/c3 93/5c 5b 27 4f 5d/g"\ + -e "s/c3 9a/5c 5b 27 55 5d/g"\ + -e "s/c3 9d/5c 5b 27 59 5d/g"\ + -e "s/c3 a1/5c 5b 27 61 5d/g"\ + -e "s/c3 a9/5c 5b 27 65 5d/g"\ + -e "s/c3 ad/5c 5b 27 69 5d/g"\ + -e "s/c3 b3/5c 5b 27 6f 5d/g"\ + -e "s/c3 ba/5c 5b 27 75 5d/g"\ + -e "s/c3 bd/5c 5b 27 79 5d/g"\ + -e "s/c3 84/5c 5b 3a 41 5d/g"\ + -e "s/c3 8b/5c 5b 3a 45 5d/g"\ + -e "s/c3 8f/5c 5b 3a 49 5d/g"\ + -e "s/c3 96/5c 5b 3a 4f 5d/g"\ + -e "s/c3 9c/5c 5b 3a 55 5d/g"\ + -e "s/c3 a4/5c 5b 3a 61 5d/g"\ + -e "s/c3 ab/5c 5b 3a 65 5d/g"\ + -e "s/c3 af/5c 5b 3a 69 5d/g"\ + -e "s/c3 b6/5c 5b 3a 6f 5d/g"\ + -e "s/c3 bc/5c 5b 3a 75 5d/g"\ + -e "s/c3 bf/5c 5b 3a 79 5d/g"\ + -e "s/c3 82/5c 5b 5e 41 5d/g"\ + -e "s/c3 8a/5c 5b 5e 45 5d/g"\ + -e "s/c3 8e/5c 5b 5e 49 5d/g"\ + -e "s/c3 94/5c 5b 5e 4f 5d/g"\ + -e "s/c3 9b/5c 5b 5e 55 5d/g"\ + -e "s/c3 a2/5c 5b 5e 61 5d/g"\ + -e "s/c3 aa/5c 5b 5e 65 5d/g"\ + -e "s/c3 ae/5c 5b 5e 69 5d/g"\ + -e "s/c3 b4/5c 5b 5e 6f 5d/g"\ + -e "s/c3 bb/5c 5b 5e 75 5d/g"\ + -e "s/c3 80/5c 5b 60 41 5d/g"\ + -e "s/c3 88/5c 5b 60 45 5d/g"\ + -e "s/c3 8c/5c 5b 60 49 5d/g"\ + -e "s/c3 92/5c 5b 60 4f 5d/g"\ + -e "s/c3 99/5c 5b 60 55 5d/g"\ + -e "s/c3 a0/5c 5b 60 61 5d/g"\ + -e "s/c3 a8/5c 5b 60 65 5d/g"\ + -e "s/c3 ac/5c 5b 60 69 5d/g"\ + -e "s/c3 b2/5c 5b 60 6f 5d/g"\ + -e "s/c3 b9/5c 5b 60 75 5d/g"\ + -e "s/c3 83/5c 5b 7e 41 5d/g"\ + -e "s/c3 91/5c 5b 7e 4e 5d/g"\ + -e "s/c3 95/5c 5b 7e 4f 5d/g"\ + -e "s/c3 a3/5c 5b 7e 61 5d/g"\ + -e "s/c3 b1/5c 5b 7e 6e 5d/g"\ + -e "s/c3 b5/5c 5b 7e 6f 5d/g"\ + -e "s/c3 87/5c 5b 2c 43 5d/g"\ + -e "s/c3 a7/5c 5b 2c 63 5d/g"\ + -e "s/c3 85/5c 5b 6f 41 5d/g"\ + -e "s/c3 a5/5c 5b 6f 61 5d/g"\ + -e "s/c5 b8/5c 5b 3a 59 5d/g"\ + -e "s/c5 a0/5c 5b 76 53 5d/g"\ + -e "s/c5 a1/5c 5b 76 73 5d/g"\ + -e "s/c5 bd/5c 5b 76 5a 5d/g"\ + -e "s/c5 be/5c 5b 76 7a 5d/g" + +# Ligatures. +ligatures() sed \ + -e "s/ef ac 80/5c 5b 66 66 5d/g"\ + -e "s/ef ac 81/5c 5b 66 69 5d/g"\ + -e "s/ef ac 82/5c 5b 66 6c 5d/g"\ + -e "s/ef ac 83/5c 5b 46 69 5d/g"\ + -e "s/ef ac 84/5c 5b 46 6c 5d/g"\ + -e "s/c5 81/5c 5b 2f 4c 5d/g"\ + -e "s/c5 82/5c 5b 2f 6c 5d/g"\ + -e "s/c3 98/5c 5b 2f 4f 5d/g"\ + -e "s/c3 b8/5c 5b 2f 6f 5d/g"\ + -e "s/c3 86/5c 5b 41 45 5d/g"\ + -e "s/c3 a6/5c 5b 61 65 5d/g"\ + -e "s/c5 92/5c 5b 4f 45 5d/g"\ + -e "s/c5 93/5c 5b 6f 65 5d/g"\ + -e "s/c4 b2/5c 5b 49 4a 5d/g"\ + -e "s/c4 b3/5c 5b 69 6a 5d/g"\ + -e "s/c4 b1/5c 5b 2e 69 5d/g"\ + -e "s/c8 b7/5c 5b 2e 6a 5d/g" + +# Text markers. +text_markers() sed \ + -e "s/e2 97 8b/5c 5b 63 69 5d/g"\ + -e "s/e2 80 a2/5c 5b 62 75 5d/g"\ + -e "s/e2 80 a1/5c 5b 64 64 5d/g"\ + -e "s/e2 80 a0/5c 5b 64 67 5d/g"\ + -e "s/e2 97 8a/5c 5b 6c 7a 5d/g"\ + -e "s/e2 96 a1/5c 5b 73 71 5d/g"\ + -e "s/c2 b6/5c 5b 70 73 5d/g"\ + -e "s/c2 a7/5c 5b 73 63 5d/g"\ + -e "s/e2 98 9c/5c 5b 6c 68 5d/g"\ + -e "s/e2 98 9e/5c 5b 72 68 5d/g"\ + -e "s/e2 86 b5/5c 5b 43 52 5d/g"\ + -e "s/e2 9c 93/5c 5b 4f 4b 5d/g" + +# These markers shouldn't be automatically translated in ms macros. +# @ "s/40/5c 5b 61 74 5d/g" +# # "s/23/5c 5b 73 68 5d/g" + +# Legal symbols. +legal_symbols() sed \ + -e "s/c2 a9/5c 5b 63 6f 5d/g"\ + -e "s/c2 ae/5c 5b 72 67 5d/g"\ + -e "s/e2 84 a2/5c 5b 74 6d 5d/g" + +hexutf8_to_hexms() { + text_markers | accents | ligatures | legal_symbols +} + +to_hex_one_column | regroup_lines | hexutf8_to_hexms | from_hex diff --git a/graphs/graphs.ms b/graphs/graphs.ms new file mode 100644 index 0000000..afbc64f --- /dev/null +++ b/graphs/graphs.ms @@ -0,0 +1,232 @@ +.NH +Graphs for DODB. +.LP +.PS +reset +.PE + +.G1 +label left "Request duration for an index (ns)" "(Median and" "fifth percentiles)" +label bot "Number of cars" + +# minx = 1e12; maxx = -1e12 +n = sigx = sigx2 = sigy = sigxy = 0 + +obram = obuncache = obcache = obsemi = 0 +cbram = cbuncache = cbcache = cbsemi = 0 + +coord y -5,75000 + +copy "../data/index.d" thru X + cx = $1*5 + + # ram cached semi uncached + line from cx,$2 to cx,$4 + line from cx,$5 to cx,$7 + line from cx,$8 to cx,$10 + line from cx,$11 to cx,$13 + + #ty = $3 + + cx = $1*5 + + cbram = $3 + cbcache = $6 + cbsemi = $9 + cbuncache = $12 + + if (obram > 0) then {line from cx,cbram to ox,obram} + if (obcache > 0) then {line from cx,cbcache to ox,obcache} +.gcolor blue + if (obsemi > 0) then {line from cx,cbsemi to ox,obsemi} +.gcolor +.gcolor green + if (obuncache > 0) then {line from cx,cbuncache to ox,obuncache} +.gcolor + + obram = cbram + obcache = cbcache + obsemi = cbsemi + obuncache = cbuncache + ox = cx + + # ram cached semi uncached +.gcolor red + bullet at cx,cbram +.gcolor + bullet at cx,cbcache +.gcolor blue + bullet at cx,cbsemi +.gcolor +.gcolor green + bullet at cx,cbuncache +.gcolor + + #n = n+1 + #sigx = sigx+$1; sigx2 = sigx2+$1*$1 + #sigy = sigy+ty; sigxy = sigxy+$1*ty + #minx = min(minx,$1); maxx = max(maxx,$1) +X + +## Calculate least squares fit and draw it +#slope = (n*sigxy - sigx*sigy) / (n*sigx2 - sigx*sigx) +#inter = (sigy - slope*sigx) / n +## print slope; print inter +#line from minx,slope*minx+inter to maxx,slope*maxx+inter +.G2 + +.G1 +label left "Request duration for a partition (ns)" "(Median and" "fifth percentiles)" +label bot "Number of cars" + +# minx = 1e12; maxx = -1e12 +n = sigx = sigx2 = sigy = sigxy = 0 + +obram = obuncache = obcache = obsemi = 0 +cbram = cbuncache = cbcache = cbsemi = 0 + +coord y -5,40000 + +copy "../data/partitions.d" thru X + cx = $1*5 + + # ram cached semi uncached + line from cx,$2 to cx,$4 + line from cx,$5 to cx,$7 + line from cx,$8 to cx,$10 + line from cx,$11 to cx,$13 + + #ty = $3 + + cbram = $3 + cbcache = $6 + cbsemi = $9 + cbuncache = $12 + + if (obram > 0) then {line from cx,cbram to ox,obram} + if (obcache > 0) then {line from cx,cbcache to ox,obcache} +.gcolor blue + if (obsemi > 0) then {line from cx,cbsemi to ox,obsemi} +.gcolor +.gcolor green + if (obuncache > 0) then {line from cx,cbuncache to ox,obuncache} +.gcolor + + obram = cbram + obcache = cbcache + obsemi = cbsemi + obuncache = cbuncache + ox = cx + + # ram cached semi uncached +.gcolor red + bullet at cx,cbram +.gcolor + bullet at cx,cbcache +.gcolor blue + bullet at cx,cbsemi +.gcolor +.gcolor green + bullet at cx,cbuncache +.gcolor + + #n = n+1 + #sigx = sigx+$1; sigx2 = sigx2+$1*$1 + #sigy = sigy+ty; sigxy = sigxy+$1*ty + #minx = min(minx,$1); maxx = max(maxx,$1) +X + +## Calculate least squares fit and draw it +#slope = (n*sigxy - sigx*sigy) / (n*sigx2 - sigx*sigx) +#inter = (sigy - slope*sigx) / n +## print slope; print inter +#line from minx,slope*minx+inter to maxx,slope*maxx+inter +.G2 + +.G1 +label left "Request duration for a tag (ns)" "(Median and" "fifth percentiles)" +label bot "Number of cars" + +# minx = 1e12; maxx = -1e12 +n = sigx = sigx2 = sigy = sigxy = 0 + +obram = obuncache = obcache = obsemi = 0 +cbram = cbuncache = cbcache = cbsemi = 0 + +coord y -5,40000 + +copy "../data/tags.d" thru X + cx = $1*5 + + # ram cached semi uncached + line from cx,$2 to cx,$4 + line from cx,$5 to cx,$7 + line from cx,$8 to cx,$10 + line from cx,$11 to cx,$13 + + #ty = $3 + + cbram = $3 + cbcache = $6 + cbsemi = $9 + cbuncache = $12 + + if (obram > 0) then {line from cx,cbram to ox,obram} + if (obcache > 0) then {line from cx,cbcache to ox,obcache} +.gcolor blue + if (obsemi > 0) then {line from cx,cbsemi to ox,obsemi} +.gcolor +.gcolor green + if (obuncache > 0) then {line from cx,cbuncache to ox,obuncache} +.gcolor + + obram = cbram + obcache = cbcache + obsemi = cbsemi + obuncache = cbuncache + ox = cx + + # ram cached semi uncached +.gcolor red + bullet at cx,cbram +.gcolor + bullet at cx,cbcache +.gcolor blue + bullet at cx,cbsemi +.gcolor +.gcolor green + bullet at cx,cbuncache +.gcolor + + #n = n+1 + #sigx = sigx+$1; sigx2 = sigx2+$1*$1 + #sigy = sigy+ty; sigxy = sigxy+$1*ty + #minx = min(minx,$1); maxx = max(maxx,$1) +X + +## Calculate least squares fit and draw it +#slope = (n*sigxy - sigx*sigy) / (n*sigx2 - sigx*sigx) +#inter = (sigy - slope*sigx) / n +## print slope; print inter +#line from minx,slope*minx+inter to maxx,slope*maxx+inter +.G2 + +.\" .G1 +.\" GROWTHFACTOR=0.07 +.\" grid bot dotted from 0 to 100 by 10 +.\" grid left dotted from 0 to 800 by 50 +.\" frame ht 2.5 wid 2.8 +.\" define expo { $1+$1*GROWTHFACTOR } +.\" value = 1 +.\" draw LINEAR solid +.\" for i from 1 to 100 by 1 do { +.\" next LINEAR at i, i +.\" times at i, value +.\" value = expo(value) +.\" } +.\" line from 0,650 to 3,650 +.\" " linear curve" ljust at 1,650 +.\" " exponential curve" ljust at 1,600 +.\" times at 1,600 +.\" label top "Exponential curves: growth over time (7%)" up -.2 +.\" .G2