+function plc_debug_txt ($message,$txt) {
+ print "<br />" . $message . "<pre>";
+ $txt=str_replace(" ","<SPC>",$txt);
+ $txt=str_replace("\t","<TAB>",$txt);
+ $txt=str_replace("\n","<LF>",$txt);
+ $txt=str_replace("\r","<CR>",$txt);
+ print $txt . "<EOF>";
+ print "</pre>";
+}
+
+$plc_prof_start=0.;
+$plc_prof_time=0.;
+$plc_prof_counter=0;
+function plc_debug_prof_start () {
+ global $plc_prof_counter, $plc_prof_start, $plc_prof_time;
+ $plc_prof_counter=0;
+ plc_debug(strftime("[0] %T (start)") ,"heating up");
+ $plc_prof_time=microtime(true);
+ $plc_prof_start=$plc_prof_time;
+}
+function plc_debug_prof ($message,$object) {
+ global $plc_prof_counter, $plc_prof_start, $plc_prof_time;
+ $plc_prof_counter+=1;
+ $now=microtime(true);
+ $timelabel=strftime("%T");
+ $prof_message=sprintf("[%d] %s (%2.3f s -- %2.3f s) ",$plc_prof_counter,$timelabel,
+ ($now-$plc_prof_time),($now-$plc_prof_start));
+ plc_debug($prof_message.$message,$object);
+ $plc_prof_time=$now;
+}
+function plc_debug_prof_end () {
+ plc_debug_prof ("end","cooling down");
+}
+