Example #1
0
function add_to_top5($profile, $fpath, &$top5)
{
    global $metrics;
    $tops = array();
    $need_metrics = array();
    $has_metrics = $profile["main()"];
    /* Get list of metrics we can extract from this profile */
    foreach ($metrics as $m) {
        $tops[$m] = new TopX();
        if (isset($has_metrics[$m])) {
            $need_metrics[] = $m;
        }
    }
    # Build top5 for each metric
    foreach ($profile as $func => $data) {
        foreach ($need_metrics as $m) {
            $tops[$m]->insert($func, $data[$m]);
        }
    }
    // Insert top5s into the master list for this timeslot
    foreach ($tops as $metric => $data) {
        $top5[$metric][$fpath] = collapse($data);
    }
}
Example #2
0
                    $degree += ceil(360 / $relationsCount);
                    imagerectangle($image, $x, $y, $x + $rectWidth, $y + $rectHeight, $color);
                    if (strlen($relation->nombre) > 0) {
                        imagestring($image, $fontSize, $x + $textX + 6, $y + $textY + 6, $relation->nombre, $fontColor);
                        $textPos += $fontHeight;
                    }
                    if (strlen($relation->empresa) > 0) {
                        imagestring($image, $fontSize, $x + 6, $y + $textPos + 6, $relation->empresa, $fontColor2);
                    }
                    imageline($image, $contact->rect['x'] + $rectWidth, $contact->rect['y'] + $rectHeight, $x, $y, $color);
                } else {
                    $x = $relation->rect['x'];
                    $y = $relation->rect['y'];
                    imageline($image, $contact->rect['x'] + $rectWidth, $contact->rect['y'] + $rectHeight, $x, $y, $color);
                }
            }
        }
        do {
            $nextX = rand($rectWidth + $relationDistance, $imageWidth - ($rectWidth + $relationDistance) * 2);
            $nextY = rand($rectHeight + $relationDistance, $imageHeight - ($rectHeight + $relationDistance) * 2);
        } while (collapse($nextX, $nextY));
        // break;
    }
}
//-->
$timeEnd = microtime(true);
$time = round(1000 * ($timeEnd - $timeStart), 3);
imagestring($image, $fontSize, $imageWidth - 60, $imageHeight - 20, $time . ' ms', $fontColor);
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);