1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
debuginfo.php
См. документацию.
1<?php
2
8
13
14IncludeModuleLangFile(__FILE__);
15
17{
20 var $savedTracker = null;
21 var $cache_size = 0;
24 static $level = 0;
25 var $is_comp = true;
26 var $index = 0;
27
28 public function __construct($is_comp = true)
29 {
30 $this->is_comp = $is_comp;
31 }
32
33 public function Start()
34 {
35 global $APPLICATION;
36 global $DB;
37 global $CACHE_STAT_BYTES;
38
39 if ($this->is_comp)
40 {
41 self::$level++;
42 }
43
44 $this->start_time = microtime(true);
45 if ($DB->ShowSqlStat)
46 {
48 $connection = $application->getConnection();
49 $this->savedTracker = $application->getConnection()->getTracker();
50
51 $connection->setTracker(null);
52 $connection->startTracker();
53 $DB->sqlTracker = $connection->getTracker();
54 }
55
56 if (Cache::getShowCacheStat())
57 {
58 $this->arCacheDebugSave = CacheTracker::getCacheTracking();
60 $this->cache_size = CacheTracker::getCacheStatBytes();
61 CacheTracker::setCacheStatBytes($CACHE_STAT_BYTES = 0);
62 }
63 $this->arResult = [];
64 $this->index = count($APPLICATION->arIncludeDebug);
65 $APPLICATION->arIncludeDebug[$this->index] = &$this->arResult;
66 }
67
68 public function Stop($rel_path = "", $path = "", $cache_type = "")
69 {
70 global $DB;
71 global $CACHE_STAT_BYTES;
72
73 if ($this->is_comp)
74 {
75 self::$level--;
76 }
77
78 $this->arResult = [
79 "PATH" => $path,
80 "REL_PATH" => $rel_path,
81 "QUERY_COUNT" => 0,
82 "QUERY_TIME" => 0,
83 "QUERIES" => [],
84 "TIME" => (microtime(true) - $this->start_time),
85 "BX_STATE" => $GLOBALS["BX_STATE"],
86 "CACHE_TYPE" => $cache_type,
87 "CACHE_SIZE" => Cache::getShowCacheStat() ? CacheTracker::getCacheStatBytes() : 0,
88 "LEVEL" => self::$level,
89 ];
90
91 if ($this->savedTracker)
92 {
94 $connection = $application->getConnection();
95 $sqlTracker = $connection->getTracker();
96
97 if ($sqlTracker->getCounter() > 0)
98 {
99 $this->arResult["QUERY_COUNT"] = $sqlTracker->getCounter();
100 $this->arResult["QUERY_TIME"] = $sqlTracker->getTime();
101 $this->arResult["QUERIES"] = $sqlTracker->getQueries();
102 }
103
104 $connection->setTracker($this->savedTracker);
105 $DB->sqlTracker = $connection->getTracker();
106 $this->savedTracker = null;
107 }
108
109 if (Cache::getShowCacheStat())
110 {
111 $this->arResult["CACHE"] = CacheTracker::getCacheTracking();
112 CacheTracker::setCacheTracking($this->arCacheDebugSave);
113 CacheTracker::setCacheStatBytes($CACHE_STAT_BYTES = $this->cache_size);
114 }
115 }
116
117 public function Output($rel_path = "", $path = "", $cache_type = "")
118 {
119 $this->Stop($rel_path, $path, $cache_type);
120
121 $result = '<div class="bx-component-debug">';
122 $result .= ($rel_path <> "" ? $rel_path . ": " : "") . "<nobr>" . round($this->arResult["TIME"], 4)
123 . " " . Loc::getMessage("main_incl_file_sec")."</nobr>";
124
125 if ($this->arResult["QUERY_COUNT"])
126 {
127 $result .= '; <a title="' . Loc::getMessage("main_incl_file_sql_stat") . '" href="javascript:BX_DEBUG_INFO_'
128 . $this->index . '.Show(); BX_DEBUG_INFO_' . $this->index
129 . '.ShowDetails(\'BX_DEBUG_INFO_' . $this->index.'_1\'); ">' . Loc::getMessage("main_incl_file_sql")
130 . ' ' . ($this->arResult["QUERY_COUNT"]) . ' (' . round($this->arResult["QUERY_TIME"], 4)
131 . ' ' . Loc::getMessage("main_incl_file_sec") . ')</a>';
132 }
133
134 if ($this->arResult["CACHE_SIZE"])
135 {
136 if ($this->arResult["CACHE"] && !empty($this->arResult["CACHE"]))
137 {
138 $result .= '<nobr>; <a href="javascript:BX_DEBUG_INFO_CACHE_' . $this->index
139 . '.Show(); BX_DEBUG_INFO_CACHE_' . $this->index . '.ShowDetails(\'BX_DEBUG_INFO_CACHE_'
140 . $this->index . '_0\');">' . Loc::getMessage("main_incl_cache_stat") . '</a> '
141 . CFile::FormatSize($this->arResult["CACHE_SIZE"], 0) . '</nobr>';
142 }
143 else
144 {
145 $result .= "<nobr>; " . Loc::getMessage("main_incl_cache_stat") . " "
146 . CFile::FormatSize($this->arResult["CACHE_SIZE"], 0) . "</nobr>";
147 }
148 }
149
150 return $result . "</div>";
151 }
152}
$path
Определения access_edit.php:21
$connection
Определения actionsdefinitions.php:38
global $APPLICATION
Определения include.php:80
static getInstance()
Определения application.php:98
static getCacheStatBytes()
Определения cachetracker.php:38
static getCacheTracking()
Определения cachetracker.php:121
static setCacheTracking($val)
Определения cachetracker.php:126
static setCacheStatBytes($cacheStatBytes)
Определения cachetracker.php:28
Определения debuginfo.php:17
$arCacheDebugSave
Определения debuginfo.php:22
$arResult
Определения debuginfo.php:23
$index
Определения debuginfo.php:26
Stop($rel_path="", $path="", $cache_type="")
Определения debuginfo.php:68
Output($rel_path="", $path="", $cache_type="")
Определения debuginfo.php:117
Start()
Определения debuginfo.php:33
$start_time
Определения debuginfo.php:18
__construct($is_comp=true)
Определения debuginfo.php:28
$savedTracker
Определения debuginfo.php:20
$cache_size
Определения debuginfo.php:21
$is_comp
Определения debuginfo.php:25
static $level
Определения debuginfo.php:24
$sqlTracker
Определения debug_info.php:28
$result
Определения get_property_values.php:14
global $DB
Определения cron_frame.php:29
$application
Определения bitrix.php:23
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения tools.php:3778
$GLOBALS['____1690880296']
Определения license.php:1
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936