Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
parf committed Mar 22, 2018
1 parent d672011 commit 45ad371
Showing 1 changed file with 35 additions and 31 deletions.
66 changes: 35 additions & 31 deletions project/app1/src/app1/action/Profiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,13 @@

namespace app1\action;


use function hb\dbg; // use ?DEBUG=1 or --debug=1 to see this messages

/*
* Sample Nested and Deep Profiling Example
**/

class Profiler extends \hb\Action {

# uri: /profiler/
function index() {
echo "<h1>Complex Profiling Example</h1>";

$API_KEY = \hb\Str::random(6);
iprofiler()->in("api-call-wrapper", ["api-params" => 'outter api call'], ['api' => $API_KEY, 'style' => 'hide']);
iprofiler()->api("api-call", ["api-params"]);
iprofiler()->info("opts[link] + args[0]", ['arg[0] text', 'a' => 'A'], ['link' => '/url/', 'edit' => '/xxx']);
iprofiler()->inHide("in and hide", ['text'], ['details' => '/url/', 'edit' => '/xxx']);
iprofiler()->api("api-call internal", ["api-params 2"]);
usleep(60200);
$a = str_repeat("xxx", 400000);
iprofiler()->out(['arg-in-out' => "a"]);
unset($a);
iprofiler()->out(['arg-in-out' => "b"]);


$x = new XXX_Very_Very_Long_ClassName();
$x->veryVeryLong_Method__Name("a", [1,2,3], "b", str_repeat("abC-", 22), $_SERVER);
unset($P);


return 0;
}

}


function A_Project($callable, ...$args) {
return $callable(...$args);
Expand All @@ -43,12 +17,12 @@ function A_Project($callable, ...$args) {
class XXX_Very_Very_Long_ClassName {

function veryVeryLong_Method__Name($a, $b, $c, $d) {
return A_Project("XXX_Very_Very_Long_ClassName::methodName", $b, [$a, [$c, $d]]);
return A_Project(__NAMESPACE__."\\"."XXX_Very_Very_Long_ClassName::methodName", $b, [$a, [$c, $d]]);
}

static function methodName($param1, &$param2, $deep = 0) {
$P = profiler(__FUNCTION__, $param1);
hb\dbg(1, "in-here");
dbg(1, "in-here");
// hb\e(hb\HB::$Q);
usleep(800);
iprofiler()->info("info", ['reason' => 'test:', 'p' => $param1]);
Expand Down Expand Up @@ -82,3 +56,33 @@ static function methodName($param1, &$param2, $deep = 0) {
}

}


class Profiler extends \hb\Action {

# uri: /profiler/
function index() {
echo "<h1>Complex Profiling Example</h1>";

$API_KEY = \hb\Str::random(6);
iprofiler()->in("api-call-wrapper", ["api-params" => 'outter api call'], ['api' => $API_KEY, 'style' => 'hide']);
iprofiler()->api("api-call", ["api-params"]);
iprofiler()->info("opts[link] + args[0]", ['arg[0] text', 'a' => 'A'], ['link' => '/url/', 'edit' => '/xxx']);
iprofiler()->inHide("in and hide", ['text'], ['details' => '/url/', 'edit' => '/xxx']);
iprofiler()->api("api-call internal", ["api-params 2"]);
usleep(60200);
$a = str_repeat("xxx", 400000);
iprofiler()->out(['arg-in-out' => "a"]);
unset($a);
iprofiler()->out(['arg-in-out' => "b"]);


$x = new XXX_Very_Very_Long_ClassName();
$x->veryVeryLong_Method__Name("a", [1,2,3], "b", str_repeat("abC-", 22), $_SERVER);
unset($P);


return 0;
}

}

0 comments on commit 45ad371

Please sign in to comment.