::iterator it;
22 |
23 | cnt = sum = 0;
24 |
25 | for (i = 0; i < sizeof(errors_man)/sizeof(errors_man[0]); ++i)
26 | {
27 | man_errors.clear();
28 | profiler_errors.clear();
29 | j = 0;
30 | fnfound = 0;
31 | while (errors_man[i].error_values[j] != MAGIC_END)
32 | {
33 | man_errors.insert(errors_man[i].error_values[j]);
34 | ++j;
35 | }
36 | for (j = 0; j < sizeof(errors_profiler)/sizeof(errors_profiler[0]); ++j)
37 | {
38 | #ifdef SYSCALLS
39 | if (errors_man[i].sysno == errors_profiler[j].sysno)
40 | #else
41 | if (0 == strcmp(errors_man[i].name, errors_profiler[j].name))
42 | #endif
43 | {
44 | fnfound = 1;
45 | k = 0;
46 | while (errors_profiler[j].error_values[k] != MAGIC_END)
47 | {
48 | #ifdef SYSCALLS
49 | if (errors_profiler[j].error_values[k] < -500)
50 | {
51 | profiler_errors.insert(EINTR);
52 | }
53 | else
54 | {
55 | profiler_errors.insert(-errors_profiler[j].error_values[k]);
56 | }
57 | #else
58 | profiler_errors.insert(errors_profiler[j].error_values[k]);
59 | #endif
60 | ++k;
61 | }
62 | break;
63 | }
64 | }
65 | if (fnfound)
66 | {
67 | found = missing = fp = 0;
68 | for (it = profiler_errors.begin(); it != profiler_errors.end(); ++it)
69 | {
70 | if (man_errors.find(*it) != man_errors.end())
71 | {
72 | ++found;
73 | }
74 | else
75 | {
76 | ++fp;
77 | }
78 | }
79 | missing = man_errors.size() - found;
80 | accuracy = (found) * 100 / ((fp+man_errors.size() > 0 ) ? (fp+man_errors.size()) : 1);
81 | if (!found && !fp && !man_errors.size())
82 | accuracy = 100;
83 | #ifdef SYSCALLS
84 | cout << "|-\n| " << errors_man[i].sysno << " || " << found << " || " << missing << " || " << fp << " || " << accuracy << "%" << endl;
85 | #else
86 | cout << "|-\n| " << errors_man[i].name << " || " << found << " || " << missing << " || " << fp << " || " << accuracy << "%" << endl;
87 | #endif
88 | ++cnt;
89 | sum += accuracy;
90 | }
91 | }
92 | cout << "Avg(accuracy): " << (float)sum/cnt << "% over " << cnt << " values" << endl;
93 | return 0;
94 | }
95 |
96 |
--------------------------------------------------------------------------------
/profiler/libxml_profiler/docparser.php:
--------------------------------------------------------------------------------
1 | #!/usr/bin/php
2 | \n";
7 | }
8 |
9 | if (count($argv) < 2)
10 | {
11 | usage($argv[0]);
12 | exit;
13 | }
14 | $clean_tags_regex = '/<(a|\/a|br|table|\/table|tbody|\/tbody|td|\/td|tr|\/tr|tt|\/tt|span|\/span|i|\/i|col)[^>]*>/';
15 | $regex = '/Function: ([^<]*)<\/h3>([^ \t]*)[^<]*<\/pre>[^<]*<\/p>\n(
)?/';
16 | $constants = '/(?: |:)(-?[\d]+)\b/';
17 |
18 | $contents = @file_get_contents($argv[1]);
19 | $results = array();
20 | $vv = 0;
21 | if (false === $contents)
22 | {
23 | echo "Invalid file/address provided: {$argv[1]}\n";
24 | } else {
25 | $contents = preg_replace($clean_tags_regex, '', $contents);
26 | $r = preg_match_all($regex, $contents, $matches);
27 | if ($r) {
28 | for ($i = 0; $i < count($matches[1]); $i++)
29 | {
30 | if (!empty($matches[3][$i]) && false === strpos($matches[1][$i], "UCSI"))
31 | {
32 | $r = strstr($matches[3][$i], "Returns");
33 | } else {
34 | $r = false;
35 | }
36 | $return_text = $r;
37 | // echo $matches[1][$i] . " " . $matches[2][$i] . "\n";
38 | if ($r)
39 | {
40 | if (false == strpos($r, "a positive error code"))
41 | {
42 | $r = preg_match_all($constants, $r, $matches2);
43 | if ($r)
44 | {
45 | for ($j = 0; $j < count($matches2[1]); $j++)
46 | {
47 | // echo $matches2[1][$j] . ", ";
48 | $results[$matches[1][$i]][] = $matches2[1][$j];
49 | }
50 | if (1 == count($matches2[1]) && (false !== strpos($matches[1][$i], 'Has') || false !== strpos($matches[1][$i], 'Is')))
51 | {
52 | // echo "0";
53 | $results[$matches[1][$i]][] = 0;
54 | }
55 | } else {
56 | if (substr($matches[2][$i], -3) == "Ptr")
57 | {
58 | // echo "NULL";
59 | $results[$matches[1][$i]][] = "NULL";
60 | }
61 | if (false !== strpos($return_text, "negative value on fail"))
62 | {
63 | $results[$matches[1][$i]][] = "-1";
64 | }
65 | }
66 | }
67 | } else {
68 | if ('void' == $matches[2][$i])
69 | {
70 | $vv++;
71 | }
72 | else
73 | {
74 | // shouldn't happen
75 | }
76 | }
77 | }
78 | }
79 | echo '#include "std_errors_head.h"' . "\n";
80 |
81 | foreach ($results as $fn => $values)
82 | {
83 | echo "int $fn" . "_man_errors[] = {\n";
84 | foreach ($values as $value)
85 | {
86 | echo $value . ",";
87 | }
88 | echo "12345};\n";
89 | }
90 |
91 | echo "\n\nstruct sys_errors errors_man[] = {";
92 | foreach ($results as $fn => $values)
93 | {
94 | echo '{ "' . $fn . '", ' . $fn . "_man_errors },\n";
95 | }
96 | echo "};\n";
97 | echo "hahh $vv";
98 | }
99 |
100 | ?>
101 |
--------------------------------------------------------------------------------
/Trigger.h:
--------------------------------------------------------------------------------
1 | /*
2 | Created by Paul Marinescu and George Candea
3 | Copyright (C) 2009 EPFL (Ecole Polytechnique Federale de Lausanne)
4 |
5 | This file is part of LFI (Library-level Fault Injector).
6 |
7 | LFI is free software: you can redistribute it and/or modify it
8 | under the terms of the GNU General Public License as published by the
9 | Free Software Foundation, either version 3 of the License, or (at
10 | your option) any later version.
11 |
12 | LFI is distributed in the hope that it will be useful, but
13 | WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | General Public License for more details.
16 |
17 | You should have received a copy of the GNU General Public
18 | License along with LFI. If not, see http://www.gnu.org/licenses/.
19 |
20 | EPFL
21 | Dependable Systems Lab (DSLAB)
22 | Room 330, Station 14
23 | 1015 Lausanne
24 | Switzerland
25 | */
26 |
27 | #include
28 | #include
29 | #include
30 | #include