Filename | /home/hejohns/documentsNoSync/22f/490/gradescope-utils/lib/Gradescope/Translate.pm |
Statements | Executed 455 statements in 3.46ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
105 | 1 | 1 | 3.13ms | 53715s | read_csv | Gradescope::Translate::
1 | 1 | 1 | 12µs | 464µs | BEGIN@4 | Gradescope::Translate::
1 | 1 | 1 | 11µs | 11µs | BEGIN@2 | Gradescope::Translate::
1 | 1 | 1 | 7µs | 30µs | BEGIN@15 | Gradescope::Translate::
1 | 1 | 1 | 6µs | 11µs | BEGIN@17 | Gradescope::Translate::
1 | 1 | 1 | 5µs | 26µs | BEGIN@19 | Gradescope::Translate::
1 | 1 | 1 | 5µs | 72µs | BEGIN@16 | Gradescope::Translate::
1 | 1 | 1 | 5µs | 16µs | BEGIN@21 | Gradescope::Translate::
1 | 1 | 1 | 4µs | 10µs | BEGIN@10 | Gradescope::Translate::
1 | 1 | 1 | 4µs | 6µs | BEGIN@3 | Gradescope::Translate::
1 | 1 | 1 | 4µs | 31µs | BEGIN@5 | Gradescope::Translate::
1 | 1 | 1 | 4µs | 41µs | BEGIN@12 | Gradescope::Translate::
1 | 1 | 1 | 4µs | 55µs | BEGIN@18 | Gradescope::Translate::
1 | 1 | 1 | 4µs | 8µs | BEGIN@7 | Gradescope::Translate::
1 | 1 | 1 | 3µs | 9µs | BEGIN@11 | Gradescope::Translate::
1 | 1 | 1 | 3µs | 9µs | BEGIN@13 | Gradescope::Translate::
1 | 1 | 1 | 2µs | 2µs | BEGIN@6 | Gradescope::Translate::
0 | 0 | 0 | 0s | 0s | __ANON__[:47] | Gradescope::Translate::
0 | 0 | 0 | 0s | 0s | print_csv | Gradescope::Translate::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | 1 | 3µs | package Gradescope::Translate v2022.12.30 { | ||
2 | 2 | 24µs | 1 | 11µs | # spent 11µs within Gradescope::Translate::BEGIN@2 which was called:
# once (11µs+0s) by main::BEGIN@50 at line 2 # spent 11µs making 1 call to Gradescope::Translate::BEGIN@2 |
3 | 2 | 16µs | 2 | 8µs | # spent 6µs (4+2) within Gradescope::Translate::BEGIN@3 which was called:
# once (4µs+2µs) by main::BEGIN@50 at line 3 # spent 6µs making 1 call to Gradescope::Translate::BEGIN@3
# spent 2µs making 1 call to utf8::import |
4 | 3 | 27µs | 3 | 916µs | # spent 464µs (12+452) within Gradescope::Translate::BEGIN@4 which was called:
# once (12µs+452µs) by main::BEGIN@50 at line 4 # spent 464µs making 1 call to Gradescope::Translate::BEGIN@4
# spent 440µs making 1 call to strictures::import
# spent 12µs making 1 call to strictures::VERSION |
5 | 2 | 24µs | 2 | 58µs | # spent 31µs (4+27) within Gradescope::Translate::BEGIN@5 which was called:
# once (4µs+27µs) by main::BEGIN@50 at line 5 # spent 31µs making 1 call to Gradescope::Translate::BEGIN@5
# spent 27µs making 1 call to open::import |
6 | 1 | 16µs | 1 | 2µs | # spent 2µs within Gradescope::Translate::BEGIN@6 which was called:
# once (2µs+0s) by main::BEGIN@50 at line 6 # spent 2µs making 1 call to Gradescope::Translate::BEGIN@6 |
7 | 2 | 19µs | 2 | 13µs | # spent 8µs (4+4) within Gradescope::Translate::BEGIN@7 which was called:
# once (4µs+4µs) by main::BEGIN@50 at line 7 # spent 8µs making 1 call to Gradescope::Translate::BEGIN@7
# spent 4µs making 1 call to diagnostics::import |
8 | |||||
9 | # turn on features | ||||
10 | 2 | 21µs | 2 | 14µs | # spent 10µs (4+5) within Gradescope::Translate::BEGIN@10 which was called:
# once (4µs+5µs) by main::BEGIN@50 at line 10 # spent 10µs making 1 call to Gradescope::Translate::BEGIN@10
# spent 5µs making 1 call to builtin::import |
11 | 2 | 18µs | 2 | 15µs | # spent 9µs (3+6) within Gradescope::Translate::BEGIN@11 which was called:
# once (3µs+6µs) by main::BEGIN@50 at line 11 # spent 9µs making 1 call to Gradescope::Translate::BEGIN@11
# spent 6µs making 1 call to warnings::unimport |
12 | 2 | 18µs | 2 | 78µs | # spent 41µs (4+37) within Gradescope::Translate::BEGIN@12 which was called:
# once (4µs+37µs) by main::BEGIN@50 at line 12 # spent 41µs making 1 call to Gradescope::Translate::BEGIN@12
# spent 37µs making 1 call to feature::import |
13 | 2 | 15µs | 2 | 14µs | # spent 9µs (3+6) within Gradescope::Translate::BEGIN@13 which was called:
# once (3µs+6µs) by main::BEGIN@50 at line 13 # spent 9µs making 1 call to Gradescope::Translate::BEGIN@13
# spent 6µs making 1 call to warnings::unimport |
14 | # end prelude | ||||
15 | 2 | 15µs | 2 | 52µs | # spent 30µs (7+23) within Gradescope::Translate::BEGIN@15 which was called:
# once (7µs+23µs) by main::BEGIN@50 at line 15 # spent 30µs making 1 call to Gradescope::Translate::BEGIN@15
# spent 23µs making 1 call to Exporter::import |
16 | 2 | 16µs | 2 | 140µs | # spent 72µs (5+68) within Gradescope::Translate::BEGIN@16 which was called:
# once (5µs+68µs) by main::BEGIN@50 at line 16 # spent 72µs making 1 call to Gradescope::Translate::BEGIN@16
# spent 68µs making 1 call to Carp::Assert::import |
17 | 2 | 14µs | 2 | 15µs | # spent 11µs (6+5) within Gradescope::Translate::BEGIN@17 which was called:
# once (6µs+5µs) by main::BEGIN@50 at line 17 # spent 11µs making 1 call to Gradescope::Translate::BEGIN@17
# spent 5µs making 1 call to Exporter::import |
18 | 2 | 15µs | 2 | 106µs | # spent 55µs (4+51) within Gradescope::Translate::BEGIN@18 which was called:
# once (4µs+51µs) by main::BEGIN@50 at line 18 # spent 55µs making 1 call to Gradescope::Translate::BEGIN@18
# spent 51µs making 1 call to JSON::import |
19 | 2 | 19µs | 2 | 46µs | # spent 26µs (5+21) within Gradescope::Translate::BEGIN@19 which was called:
# once (5µs+21µs) by main::BEGIN@50 at line 19 # spent 26µs making 1 call to Gradescope::Translate::BEGIN@19
# spent 21µs making 1 call to Exporter::import |
20 | |||||
21 | 2 | 184µs | 2 | 28µs | # spent 16µs (5+12) within Gradescope::Translate::BEGIN@21 which was called:
# once (5µs+12µs) by main::BEGIN@50 at line 21 # spent 16µs making 1 call to Gradescope::Translate::BEGIN@21
# spent 12µs making 1 call to parent::import |
22 | |||||
23 | # default exports | ||||
24 | 1 | 300ns | our @EXPORT = qw(); | ||
25 | # optional exports | ||||
26 | 1 | 800ns | our @EXPORT_OK = qw( | ||
27 | print_csv | ||||
28 | read_csv | ||||
29 | ); | ||||
30 | |||||
31 | sub print_csv { | ||||
32 | my ($in, $out) = @_; | ||||
33 | Text::CSV::csv({ | ||||
34 | # attributes (OO interface) | ||||
35 | binary => 0, | ||||
36 | decode_utf8 => 0, | ||||
37 | strict => 1, | ||||
38 | # `csv` arguments | ||||
39 | in => $in, | ||||
40 | out => $out, | ||||
41 | encoding => ':utf8', | ||||
42 | }) or confess Text::CSV->error_diag; | ||||
43 | } | ||||
44 | |||||
45 | # spent 53715s (3.13ms+53715) within Gradescope::Translate::read_csv which was called 105 times, avg 512s/call:
# 105 times (3.13ms+53715s) by main::RUNTIME at line 91 of /home/hejohns/documentsNoSync/22f/490/gradescope-utils/bin/split.pl, avg 512s/call | ||||
46 | 105 | 77µs | my ($csv_path, $key_header, $value_header, $filter) = @_; | ||
47 | 105 | 25µs | $filter //= sub {true}; | ||
48 | 105 | 2.00ms | 105 | 53715s | my %kv = %{Text::CSV::csv ({ # spent 53715s making 105 calls to Text::CSV_XS::csv, avg 512s/call |
49 | # attributes (OO interface) | ||||
50 | binary => 0, | ||||
51 | decode_utf8 => 0, | ||||
52 | strict => 1, | ||||
53 | # `csv` arguments | ||||
54 | in => $csv_path, | ||||
55 | filter => $filter, | ||||
56 | encoding => 'UTF-8', | ||||
57 | key => $key_header, | ||||
58 | value => $value_header, | ||||
59 | }) or confess Text::CSV->error_diag}; | ||||
60 | 105 | 892µs | return %kv; | ||
61 | } | ||||
62 | |||||
63 | } | ||||
64 | |||||
65 | # ABSTRACT: Gradescope submission script component | ||||
66 | =pod | ||||
67 | |||||
68 | =encoding utf8 | ||||
69 | |||||
70 | =head1 DESCRIPTION | ||||
71 | |||||
72 | C<Text::CSV> wrappers | ||||
73 | |||||
74 | =cut |