PluginProbe
Code Profiler – WordPress Performance Profiling and Debugging Made Easy / trunk
Code Profiler – WordPress Performance Profiling and Debugging Made Easy vtrunk
1.9.5 1.9.4 1.9.3 trunk 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.6 1.6.1 1.6.10 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 All 40 releases
code-profiler / lib / menu_view_diskio.php

menu_view_diskio.php in Code Profiler – WordPress Performance Profiling and Debugging Made Easy trunk, at lib/menu_view_diskio.php

73 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 +=====================================================================+
4 | ____ _ ____ __ _ _ |
5 | / ___|___ __| | ___ | _ \ _ __ ___ / _(_) | ___ _ __ |
6 | | | / _ \ / _` |/ _ \ | |_) | '__/ _ \| |_| | |/ _ \ '__| |
7 | | |__| (_) | (_| | __/ | __/| | | (_) | _| | | __/ | |
8 | \____\___/ \__,_|\___| |_| |_| \___/|_| |_|_|\___|_| |
9 | |
10 | (c) Jerome Bruandet ~ https://nintechnet.com/codeprofiler/ |
11 +=====================================================================+
12 */
13
14 if (! defined( 'ABSPATH' ) ) { die( 'Forbidden' ); }
15
16 // =====================================================================
17 // Display File I/O stats.
18
19 $buffer = code_profiler_get_profile_data( $profile_path, 'diskio' );
20 if ( isset( $buffer['error'] ) ) {
21 return;
22 }
23
24 // Fetch options
25 $cp_options = get_option( 'code-profiler' );
26
27 // Horizontal vs vertical chart
28 if ( empty( $cp_options['chart_type'] ) || ! in_array( $cp_options['chart_type'], ['x', 'y' ] ) ) {
29 $axis = 'x';
30 } else {
31 $axis = $cp_options['chart_type'];
32 }
33
34 ?>
35 <div style="width:80vw;margin:auto" aria-hidden="true">
36 <canvas id="myChart"></canvas>
37 </div>
38 <script>
39 jQuery(document).ready(function() {
40 'use strict';
41 cpjs_diskio_chart(
42 '<?php echo esc_js( $axis ) ?>', [<?php
43 echo "'". esc_js( __('I/O Read bytes', 'code-profiler') ) .
44 "', '". esc_js( __('I/O Write bytes', 'code-profiler') ) .
45 "'" ?>], [<?php
46 echo "'". (int) $buffer[0][1] ."', '". (int) $buffer[1][1] ."'"
47 ?>]
48 );
49 });
50 </script>
51
52 <!-- Screen-reader only -->
53 <div class="visually-hidden">
54 <?php
55 echo "<table>\n".
56 "\t<tr>\n".
57 "\t\t<td>". esc_html__('I/O Read bytes', 'code-profiler') ."</td>".
58 "<td>". esc_html__('I/O Write bytes', 'code-profiler') ."</td>\n".
59 "\t<tr>\n\t\t<td>". esc_html( number_format( $buffer[0][1] ) ) ."</td>".
60 "<td>". esc_html( number_format( $buffer[1][1] ) ) ."</td>\n\t</tr>\n".
61 "</table>\n";
62 ?>
63 </div>
64 <!-- End of Screen-reader only -->
65
66 <?php
67 // Actions below stats
68 $save_png = 1;
69 $rotate_img = 1;
70 $type = 'diskio';
71 // =====================================================================
72 // EOF
73