crVCL PHP Framework Version 2.9
  • Class
  • Tree
  • Todo
  • Download

Classes

  • _html_Doc
  • array2domxml
  • array2xml
  • cap_str
  • chart
  • chartline
  • config_crvcl_inc
  • Contoller
  • ContollerMain
  • ContollerPage
  • Controller
  • ControllerMain
  • ControllerPage
  • CouchDB
  • crAsync
  • crDateTime
  • CriticalSection
  • crJWT
  • crVCLSessionHandler
  • daemon
  • dictBase
  • domxml2array
  • DTA
  • DTAUS
  • DTAZV
  • ErrorHandler
  • ExceptionHandler
  • ffmpegbin
  • fsock
  • GeoIPLib
  • GoogleAnalyticsParser
  • htaccess
  • html5_Video
  • html_Anchor
  • html_Button
  • html_Calendar
  • html_Checkbox
  • html_ChkListbox
  • html_Choosebox
  • html_CKEditor
  • html_Colorbox
  • html_Combobox
  • html_Component
  • html_ComponentAMP
  • html_Datepicker
  • html_DivTable
  • html_Doc
  • html_DocAMP
  • html_Edit
  • html_Events
  • html_FlvBox
  • html_FocusEvents
  • html_FocusEventsEx
  • html_FoldingBox
  • html_Form
  • html_GroupBox
  • html_iFrame
  • html_Img
  • html_ImgAMP
  • html_InfoBox
  • html_Label
  • html_LinkLabel
  • html_List
  • html_Listbox
  • html_Marquee
  • html_Marquee2
  • html_Memo
  • html_Msgbox
  • html_OpenDialog
  • html_Optionbox
  • html_Panel
  • html_Radiobutton
  • html_Resultbar
  • html_RichText
  • html_Slider
  • html_Spinbutton
  • html_TabbedPane
  • html_TabControl
  • html_Table
  • html_tagCloud
  • html_TinyMCE
  • html_Window
  • http
  • httprequest
  • imap
  • imap_attachment
  • imap_body
  • imap_header
  • imap_msg
  • imgbar
  • Int64
  • JBridge
  • Logger
  • mail
  • multiAjaxHtmlResponse
  • mvc_module_loader
  • MySQL
  • MySQL_
  • MySQLBuilder
  • MySQLLang
  • MySQLResult
  • OpcodeCache
  • PDF
  • process_pid
  • QRCodeMinified
  • Redis
  • RESTful
  • RESTful_Client
  • RESTful_Server
  • RSS
  • rtf
  • sasl
  • sasl_basic
  • sasl_cram_md5
  • sasl_digest
  • sasl_interact
  • sasl_login
  • sasl_ntlm
  • sasl_plain
  • SepaRecord
  • SepaXML
  • SessionHandlerMemcache
  • SessionHandlerMySQL
  • SessionHandlerMySQLi
  • SessionHandlerRedis
  • shm
  • sitemap
  • SocialLib
  • sphinxAPI
  • sphinxQL
  • sphinxQLBuilder
  • sphinxResult
  • SQLiteDB
  • SQLiteDB_
  • SQLiteDBBuilder
  • SQLiteDBResult
  • template
  • TimeTrace
  • Viewer
  • whoisrequest
  • WSThread
  • XDXF_Parser
  • xml2array
  • xmlHelper
  • XMLRPC
  • XMLRPC_Client
  • XMLRPC_Server
  • zipLib

Interfaces

  • html_iComponent
  • icrVCLSessionHandler

Traits

  • html_tComponent

Functions

  • _ISO_Lang_Convert
  • acount
  • add_trailing_slash
  • addAjaxAnswerToElement
  • ajax_callback
  • ajax_request
  • ajax_setFormData2Fragment
  • ajax_setFragment2FormData
  • ajax_translate_special_char
  • Ansi2OEM
  • apache_request_headers
  • apc_opcode_priming_compiler
  • array2js_form_set
  • array2js_from_set
  • Array2strAttribute
  • array2string
  • array2UrlData
  • array_combine_values
  • array_concat
  • array_del
  • array_filelist
  • array_gcd
  • array_insert
  • array_isearch
  • array_key_existsEx
  • array_lcm
  • array_mix
  • array_remove_empty
  • array_search_inner
  • array_search_key
  • array_search_needle
  • array_trim
  • array_xunique
  • ascii_non_visible_decode
  • authcode
  • authenticate
  • average
  • bandwidth2byteInt
  • base64_encode_bin
  • bitInValue
  • bitVal2array
  • boolstr
  • boolToSetting
  • boolval
  • boolvalEx
  • breakpoint_set
  • breakpoint_stop
  • breakpoint_watch
  • browserSupportAjax
  • byte2str
  • calculate_RFC2104HMAC
  • cast_str
  • checkdnsrr
  • checkEmail
  • chrEx
  • cidr_match
  • clearscreen
  • com_create_guid
  • copyEx
  • cpu_get_usage
  • create_menu
  • createVisiblePageRank
  • CRLF_fix
  • cron_scheduling
  • crVCLProfiler
  • cursor_color
  • cursor_down
  • cursor_erase_eol
  • cursor_erase_line
  • cursor_erase_sol
  • cursor_left
  • cursor_pos
  • cursor_restore
  • cursor_right
  • cursor_save
  • cursor_unsave
  • cursor_up
  • data_uri
  • date2MySQLDate
  • date2Timestamp
  • dateFormat
  • dateToMySQLDate
  • debug_backtrace_string
  • debugbreak
  • debugOut
  • DEC2DMS
  • dec2str
  • decryptEx
  • deepCopy
  • defineEx
  • diffDays
  • diffHour
  • diffMin
  • diffSec
  • dir_exists
  • DMS2Array
  • DMS2DEC
  • dns_get_mx
  • download
  • download_authcode_url
  • download_from_authcode
  • download_iframe
  • download_popup
  • enableCORS
  • encryptEx
  • escape_js
  • EU_VAT_Validate
  • even
  • extractFileExt
  • extractFileName
  • file_get_mimetype
  • file_read
  • file_write
  • fileExist
  • filepermsEx
  • firebugOut
  • fix_https
  • fix_session_register
  • fixpath
  • font
  • free
  • ftok
  • fw_exception_error_handler
  • fw_mvc_reset_component_changed
  • fwErrorHandler
  • fwExceptionHandler
  • gc_collect_cycles_overX
  • gcd
  • get_browserEx
  • get_defined_constantsEx
  • get_file_from_url
  • get_include_contents
  • get_Post_RAW_Data
  • get_profiler_info
  • getAlexaPageRank
  • getallheadersEx
  • getallheadersSize
  • getBrowser
  • getClientLanguage
  • getCountryList
  • getEthnicList
  • getFrameworkCSS
  • getFrameworkJS
  • getGooglePageRank
  • getLanguageList
  • getMonthList
  • getOrigin
  • getOS
  • getPHP_OS
  • getPHP_Version
  • getProxyInfo
  • getQuarter
  • getRealIp
  • getScript
  • getScriptPath
  • getServer
  • getSTDIN
  • getSubdomain
  • gettickcount
  • getURL
  • getURLPath
  • getWeekdayList
  • googleCH
  • googleTranslator
  • GUID
  • guidEx
  • gzdecodeEx
  • header_cache
  • header_http_error
  • header_nocache
  • hex2rgb
  • hex2str
  • html2text
  • html_entity_decode
  • htmldecode
  • http
  • httpAuth
  • https
  • imagick_fingerprint
  • in_arrayEx
  • iniBuffer2BlockArray
  • iniRead
  • iniWrite
  • interval
  • intval32
  • is_base64_encoded
  • is_bin
  • is_crawler
  • is_date
  • is_https
  • is_IE
  • is_mobile
  • is_number
  • is_robot
  • is_spider
  • is_ssl
  • is_utf8
  • is_utf8Ex
  • is_windows
  • iso_decode
  • ISOLang2Letter3Letter
  • ISOLang3Letter2Letter
  • issetOr
  • js
  • js_getFormData
  • js_mailto
  • js_removeFormData
  • js_safeEMail
  • JSON_FixDoubleSerialization
  • JSON_FixSingleElementArray
  • lcm
  • left
  • levenshtein_ratio
  • levenshteinEx
  • linefeed_detect
  • luhnCheck
  • marquee
  • mb_str_replace
  • measure
  • mix
  • mount
  • move
  • msgbox
  • mssleep
  • mvc_ajax_event
  • mvc_alert
  • mvc_component_changed
  • mvc_confirmbox
  • mvc_event
  • mvc_flags
  • mvc_prompt
  • mysql_isDateEmpty
  • mysql_isDateSet
  • mysql_SET_isCondition
  • mysql_unix_timestamp
  • MySQLFilter
  • normalize
  • normalize_filename
  • object2array
  • OEM2Ansi
  • optimizeCSS
  • optimizeHTML
  • optimizeJS
  • ordEx
  • parse_include
  • parseCmdPara
  • parseHeaders
  • passwordStrength
  • pcntl_pid_exists
  • phpinfoEx
  • portscan
  • pp
  • pp_xml
  • preg_last_error_msg
  • print_ajax
  • print_br
  • print_chunked
  • print_d
  • print_gz
  • print_pretty
  • print_pretty_xml
  • protocol
  • pwGen
  • quoted_printable_encode
  • random
  • redirect
  • remove_tags
  • request_async
  • reset_last_modified_for_internal_http_cache
  • rgb2hex
  • rgb2hsb
  • rgb2hsv
  • right
  • runExternal
  • rval
  • ScriptProtection
  • sec2str
  • seo_code_to_text_ratio
  • seo_keyword_density
  • seo_page_informations
  • session_clean_user_cookies
  • session_commitEx
  • session_end
  • session_expires
  • session_is_started
  • session_logout
  • setAjaxAnswerToElement
  • setting_sqlite_read
  • setting_sqlite_write
  • showFrameworkError
  • shutdown_function_crVCL_FatalError
  • socket_writeEx
  • space
  • str2bin
  • str2byteInt
  • str2dec
  • str2hex
  • str2sec
  • str_del
  • str_extract
  • str_getAttributeVal
  • str_getCssValue
  • str_parse_tags
  • str_random
  • str_replace_bin
  • str_trim_len
  • strAttribute2Array
  • strax
  • strcut
  • strcut_bin
  • strftimeEx
  • strhtmlformat
  • stricut
  • stricut_bin
  • string2array
  • strip_chars
  • strip_linebreaks
  • strip_spaces
  • stripHTML
  • stripInvalidXml
  • stripos_bin
  • stripWhiteSpace
  • strlen_bin
  • strOrd
  • strpos_bin
  • strpos_next_word
  • strrcut
  • strrcut_bin
  • strricut
  • strricut_bin
  • strripos_bin
  • strrpos_bin
  • strrpos_next_word
  • strtolower_bin
  • strtonum
  • strtoupper_bin
  • strzero
  • strzerocast
  • substr_bin
  • terminal_beep
  • terminal_cols
  • terminal_lines
  • text2html
  • timestamp2MySQLDateTime
  • trim_specialchars
  • trim_text
  • umount
  • unauthorized
  • unicode_array
  • unique_key
  • unix2DosTime
  • unlink_files
  • unpack31
  • unserializeEx
  • unserializeEx_v1
  • unserializeEx_v2
  • unzip
  • urlData2Array
  • utcdate
  • utf8_encodeEx
  • utf8_fix
  • utf8_to_RTF
  • UUID
  • validateEmail
  • var_dumpEx
  • var_dumpExHTML
  • var_name
  • waitForInput
  • wordwarp_detect
  • writeTrace
  • wsthread_exception_error_handler
  • XML2JSON
  • xmlentities
  • xmlentities_decode
  • xmlentitiesEx
  • xmlGetPara
  • xmlGetVal
  • xor32
  • XSSFilter
  • zeroFill
  • zlib_compression
  1 <?PHP
  2 
  3 // $Author: Ricardo Cescon $
  4 // $Date: 2017-12-22 11:00 +0100 $
  5 // $Id: timetrace.lib.php 1894:1f4c988270e1 2017-12-22 11:00 +0100 projects $
  6 // $Revision: 1894:1f4c988270e1 $
  7 // $Lastlog: stabile version 2.9 $
  8 
  9 
 10 /*
 11 
 12 The contents of this file are subject to the Mozilla Public License
 13 Version 1.1 (the "License"); you may not use this file except in compliance
 14 with the License. You may obtain a copy of the License at
 15 http://www.mozilla.org/MPL/MPL-1.1.html or see MPL-1.1.txt in directory "license"
 16 
 17 Software distributed under the License is distributed on an "AS IS" basis,
 18 WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
 19 the specific language governing rights and limitations under the License.
 20 
 21 The Initial Developers of the Original Code are: 
 22 Copyright (c) 2003-2017, CR-Solutions (http://www.cr-solutions.net), Ricardo Cescon
 23 All Rights Reserved.
 24 
 25 Contributor(s): PanterMedia GmbH (http://www.panthermedia.net), Peter Ammel
 26 
 27 crVCL PHP Framework Version 2.9
 28 */
 29 
 30 
 31 
 32 
 33 
 34 ############################################################
 35 if(!defined("TIMETRACE_LIB")){
 36    define ("TIMETRACE_LIB", 1);
 37 ############################################################
 38 
 39 
 40 class TimeTrace{
 41     // private  
 42     var $m_logger = null;
 43     var $m_stick = array();
 44     var $m_enabeld = true;
 45 
 46     // public
 47     /**
 48      * path for trace file
 49      *
 50      * @var string
 51      */
 52     var $m_trace_path = "";
 53     /**
 54      * filename of tracefile
 55      *
 56      * @var string
 57      */
 58     var $m_trace_file = "";
 59     /**
 60      * size before trace file will set to zero
 61      *
 62      * @var mixed
 63      */
 64     var $m_trace_delAfter = "1024K";
 65     /**
 66      * append info of sriptname and url
 67      *
 68      * @var bool
 69      */
 70     var $m_append_script_info = false;
 71     /**
 72      * append timestamp
 73      *
 74      * @var bool
 75      */
 76     var $m_append_timestamp = true;
 77     /**
 78      * enable critical section for write trace files
 79      *
 80      * @var string
 81      */
 82     var $m_trace_critical_section_id = null;
 83     /**
 84      * path to share the critical section for write trace files
 85      *
 86      * @var string
 87      */
 88     var $m_trace_critical_section_path = "./";
 89     /**
 90      * max lock time for zombie processes
 91      *
 92      * @var int
 93      */
 94     var $m_trace_critical_section_maxlock_ms = 1000;
 95     /**
 96      * sleep for retry enter critical section
 97      *
 98      * @var int
 99      */
100     var $m_trace_critical_section_sleep_ms = 10;
101    /**
102      * write the trace to a SQLite file instead of a text file
103      *
104      * @var bool
105      */
106     var $m_trace_sqlite = false;
107 //-------------------------------------------------------------------------------------------------------------------------------------
108 // constructor
109     /**
110      * time trace
111      *
112      * @param bool $enabeld
113      * @return TimeTrace
114      */
115     function __construct($enabeld=true){
116        $this->m_logger = new Logger();
117        $this->m_enabeld = $enabeld;
118     }
119 //-------------------------------------------------------------------------------------------------------------------------------------
120     function __destruct(){
121        $this->free();
122     }    
123 //-------------------------------------------------------------------------------------------------------------------------------------
124 // private
125    /**    
126     * @return Logger
127     */
128    function &getLogger(){
129       return $this->m_logger;
130    } 
131 //-------------------------------------------------------------------------------------------------------------------------------------   
132    function writeTrace($s){      
133       $path = $this->m_trace_path;
134       $file = $this->m_trace_file;
135       $del = $this->m_trace_delAfter;
136       $crit_id = $this->m_trace_critical_section_id;
137       $crit_path = $this->m_trace_critical_section_path;
138       $crit_maxlock = $this->m_trace_critical_section_maxlock_ms;
139       $crit_sleep = $this->m_trace_critical_section_sleep_ms;
140       
141       if(!empty($path) || !empty($file)){
142         if(empty($file)){
143             $file = "timetrace.lib.trc";
144         }
145          $logger = &$this->getLogger();   
146          $logger->setOutputFile($path, $file, $del);
147          $logger->setOutputFile_CriticalSectionId($crit_id, $crit_path, 
148                                                   $crit_maxlock, $crit_sleep);
149          $logger->enableOutputFile(true, $this->m_trace_sqlite);
150          $logger->enableHeaderOutput(true);
151          $logger->log(LOG_LEVEL_DEBUG, $s);
152       }                 
153     }
154 //-------------------------------------------------------------------------------------------------------------------------------------
155     function free(){
156        $this->clearAll();
157     }
158 //-------------------------------------------------------------------------------------------------------------------------------------
159 // public
160    /**
161     * clear all trace counts
162     */
163    function clearAll(){
164       $this->m_stick = array();
165    }
166 //-------------------------------------------------------------------------------------------------------------------------------------   
167    /**
168     * clear a trace counts
169     */
170    function clear($id){
171       if(isset($this->m_stick[$id])){
172          unset($this->m_stick[$id]);
173       }
174    }
175 //-------------------------------------------------------------------------------------------------------------------------------------   
176    /**
177     * start a trace count
178     *
179     * @param string $id
180     */
181    function start($id){           
182       if(!$this->m_enabeld) return;      
183       $this->m_stick[$id] = gettickcount();      
184    }
185 //-------------------------------------------------------------------------------------------------------------------------------------
186    /**
187     * stop a trace count
188     *
189     * @param string $id
190     * @param string $msg
191     */
192    function stop($id, $msg=""){           
193       if(!$this->m_enabeld) return;
194       if(isset($this->m_stick[$id])){
195          $stick = $this->m_stick[$id];
196          $time = gettickcount()-$stick;
197          if(!empty($msg)){
198             $msg = " - ".$msg;
199          }
200          $this->writeTrace($id.$msg." - ".$time." ms");         
201       }   
202    }
203 //-------------------------------------------------------------------------------------------------------------------------------------
204    /**
205     * similar stop, but reset also the trace count
206     *
207     * @param string $id
208     * @param string $msg
209     */
210    function rstop($id, $msg=""){           
211       $this->stop($id, $msg);
212       $this->start($id);
213    }
214 //-------------------------------------------------------------------------------------------------------------------------------------
215    function setSeparator(){     
216       if(!$this->m_enabeld) return;     
217         $at_old = $this->m_append_timestamp;
218         $asi_old = $this->m_append_script_info;
219    
220         $this->m_append_timestamp = false;
221         $this->m_append_script_info = false;        
222         $this->writeTrace(str_repeat("#", 50)."\r\n\r\n");
223         
224         $this->m_append_timestamp = $at_old;
225         $this->m_append_script_info = $asi_old;     
226    }
227 //-------------------------------------------------------------------------------------------------------------------------------------
228    function setHead($msg){
229       if(!$this->m_enabeld) return;
230       $at_old = $this->m_append_timestamp;
231         $asi_old = $this->m_append_script_info;
232    
233         $this->m_append_timestamp = false;
234         $this->m_append_script_info = false;        
235         $this->writeTrace("-   ".$msg."   -");
236         
237         $this->m_append_timestamp = $at_old;
238         $this->m_append_script_info = $asi_old;     
239    }
240 //-------------------------------------------------------------------------------------------------------------------------------------
241 }
242 //-------------------------------------------------------------------------------------------------------------------------------------
243 ############################################################
244 }
245 ############################################################
246 ?>
crVCL PHP Framework Version 2.9 API documentation generated by ApiGen