Giter Site home page Giter Site logo

perftools / xhgui Goto Github PK

View Code? Open in Web Editor NEW
1.6K 68.0 340.0 1.9 MB

Web interface for XHProf profiling data can store data in MongoDB or PDO database

PHP 37.99% CSS 2.04% JavaScript 46.31% Dockerfile 0.76% Twig 12.71% Shell 0.19%
mongodb profiler php xhprof ext-pdo ext-mongodb profiling-data xhgui

xhgui's Introduction

XHGui

A graphical interface for XHProf profiling data that can store the results in MongoDB or PDO database.

Application is profiled and the profiling data is transferred to XHGui, which takes that information, saves it in MongoDB (or PDO database), and provides a convenient GUI for working with it.

This project is the GUI for showing profiling results, to profile your application, use specific minimal library:

Build Status Scrutinizer Code Quality Code Coverage

System Requirements

XHGui has the following requirements:

  • Known to work: PHP >= 7.2, 8.0, 8.1
  • If using MongoDB storage, see MongoDB requirements
  • If using PDO storage, see PDO requirements
  • To profile an application, one of the profiling PHP extensions is required. See Profiling a Web Request or CLI script. The extension is not needed to run XHGui itself.

If you need to decide which backend to use, you can check the compatibility matrix what features are implemented or missing per backend.

MongoDB

The default installation uses MongoDB database. Most of the documentation speaks about MongoDB.

  • MongoDB Extension MongoDB PHP driver: pecl install mongodb XHGui requires version 1.3.0 or later.
  • MongoDB MongoDB Itself. XHGui requires version 3.2 or later.

PDO

  • PDO PHP extension

Any of the drivers and an accompanying database:

NOTE: PDO may not support all the features of XHGui, see #320.

Installation from source

  1. Clone or download xhgui from GitHub.

  2. Point your webserver to the webroot directory.

  3. Set the permissions on the cache directory to allow the webserver to create files. If you're lazy, 0777 will work.

    The following command changes the permissions for the cache directory:

    chmod -R 0777 cache
  4. Start a MongoDB instance. XHGui uses the MongoDB instance to store profiling data.

  5. If your MongoDB setup uses authentication, or isn't running on the default port and localhost, update XHGui's config/config.php so that XHGui can connect to your mongod instance.

  6. (Optional, but recommended) Add indexes to MongoDB to improve performance.

    XHGui stores profiling information in a results collection in the xhprof database in MongoDB. Adding indexes improves performance, letting you navigate pages more quickly.

    To add an index, open a mongo shell from your command prompt. Then, use MongoDB's db.collection.ensureIndex() method to add the indexes, as in the following:

    $ mongo
    > use xhprof
    > db.results.ensureIndex( { 'meta.SERVER.REQUEST_TIME' : -1 } )
    > db.results.ensureIndex( { 'profile.main().wt' : -1 } )
    > db.results.ensureIndex( { 'profile.main().mu' : -1 } )
    > db.results.ensureIndex( { 'profile.main().cpu' : -1 } )
    > db.results.ensureIndex( { 'meta.url' : 1 } )
    > db.results.ensureIndex( { 'meta.simple_url' : 1 } )
    > db.results.ensureIndex( { 'meta.SERVER.SERVER_NAME' : 1 } )
    
  7. Install dependencies with composer

    composer install --no-dev
  8. Set up your webserver. The Configuration section below describes how to setup the rewrite rules for both nginx and apache.

Installation with Docker

This setup uses docker-compose to orchestrate docker containers.

  1. Clone or download xhgui from GitHub.

  2. Startup the containers: docker-compose up -d

  3. Open your browser at http://xhgui.127.0.0.1.xip.io:8142 or just http://localhost:8142 or type at terminal composer open

  4. To customize xhgui, copy config/config.default.php to config/config.php and edit that file.

  5. To customize docker-compose, copy docker-compose.yml to docker-compose.override.yml and edit that file.

Configuration

Configure Webserver Re-Write Rules

XHGui prefers to have URL rewriting enabled, but will work without it. For Apache, you can do the following to enable URL rewriting:

  1. Make sure that an .htaccess override is allowed and that AllowOverride has the directive FileInfo set for the correct DocumentRoot.

    Example configuration for Apache 2.4:

    <Directory /var/www/xhgui/>
        Options Indexes FollowSymLinks
        AllowOverride FileInfo
        Require all granted
    </Directory>
  2. Make sure you are loading up mod_rewrite correctly. You should see something like:

    LoadModule rewrite_module libexec/apache2/mod_rewrite.so
  3. XHGui comes with a .htaccess file to enable the remaining rewrite rules.

For nginx and fast-cgi, you can use the following snippet as a start:

server {
    listen   80;
    server_name example.com;

    # root directive should be global
    root   /var/www/example.com/public/xhgui/webroot/;
    index  index.php;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        try_files $uri =404;
        include /etc/nginx/fastcgi_params;
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_index   index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

Profiling a Web Request or CLI script

The supported way to profile an application is to use perftools/php-profiler package.

You can use that package to collect data from your web application or a CLI script.

This data is then pushed into XHGui database where it can be viewed with XHGui application.

The php-profiler package offers submitting data directly to XHGui instance once the profiling is complete at the end of the request.

If the application cannot directly connect to XHGui instance, the package offers solution to capture profiling data to a file which you can import later using the import script.

Warning: Importing the same file twice will create duplicate profiles.

Limiting MongoDB Disk Usage

Disk usage can grow quickly, especially when profiling applications with large code bases or that use larger frameworks.

To keep the growth in check, configure MongoDB to automatically delete profiling documents once they have reached a certain age by creating a TTL index.

Decide on a maximum profile document age in seconds: you may wish to choose a lower value in development (where you profile everything), than production (where you profile only a selection of documents). The following command instructs Mongo to delete documents over 5 days (432000 seconds) old.

$ mongo
> use xhprof
> db.results.ensureIndex( { "meta.request_ts" : 1 }, { expireAfterSeconds : 432000 } )

Waterfall Display

The goal of XHGui's waterfall display is to recognize that concurrent requests can affect each other. Concurrent database requests, CPU-intensive activities and even locks on session files can become relevant. With an Ajax-heavy application, understanding the page build is far more complex than a single load: hopefully the waterfall can help. Remember, if you're only profiling a sample of requests, the waterfall fills you with impolite lies.

Some Notes:

  • There should probably be more indexes on MongoDB for this to be performant.
  • The waterfall display introduces storage of a new request_ts_micro value, as second level granularity doesn't work well with waterfalls.
  • The waterfall display is still very much in alpha.
  • Feedback and pull requests are welcome :)

Monitoring

Prometheus metrics suitable for monitoring service health are exposed on /metrics. (This currently only works if using PDO for storage.)

Compatibility matrix

Feature MongoDB PDO
Prometheus exporter #305
Searcher::latest()
Searcher::query() #384
Searcher::get()
Searcher::getForUrl() #436
Searcher::getPercentileForUrl() #436
Searcher::getAvgsForUrl() #384
Searcher::getAll(sort) #436
Searcher::getAll(direction) #436
Searcher::delete()
Searcher::truncate()
Searcher::saveWatch() #435
Searcher::getAllWatches() #435
Searcher::truncateWatches() #435
Searcher::stats() #305
Searcher::getAllServerNames() #460

Releases / Changelog

See the releases for changelogs, and release information.

License

Copyright (c) 2013 Mark Story & Paul Reinheimer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

xhgui's People

Contributors

1ma avatar aheinz-sg avatar anho avatar atdt avatar beberlei avatar benbor avatar bertrandmalet avatar codespill avatar david-garcia-garcia avatar dshafik avatar dumityty avatar fengqi avatar ghostwriter avatar glensc avatar kornrunner avatar krinkle avatar lauripiisang avatar lornajane avatar markstory avatar mszabo-wikia avatar mte90 avatar ossinkine avatar panychek avatar preinheimer avatar sebbrandt87 avatar skors avatar sunanzhi avatar sylus avatar thbourlove avatar tsari avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xhgui's Issues

Possibly use NVD3 for graphs

While the graphs currently in XHGui work they are kind of a homebrew job that might be better accomplished with a more mature graphing toolset built on top of d3. NVD3 charts look great have a decent API and are licensed under the Apache 2.0 license.

I think adopting nvd3 might help make the graphs nicer, more future proof and allow us to add new graph types more easily in the future.

class Xhgui_Profiles method "paginate" return so large data

Now I saw my mongo db in results collection have more than 400W record.
when the paginate find record for the url list, it return so large data and cost more times.

the url: /url/view?url=* is always give the error:
qq20140126181913

1: the most fields in the document is not to need. I give a parameter to the find method made it return the need fields then the find speed is better.
qq20140126181318
2: the other resaon
the method "getPercentileForUrl", it use "aggregate", it also take so many times.
but now I don't konw how to Optimize it, I think should write a crontab script excute everty day, call this function and then save the result in another collection, then find the result from the new collection, it will passed the aggregate's Calculate time, there just select time.
or use ajax call getPercentileForUrl to graph.
any other idea?

PHP DOM extenstion

Php-Unit requires ext-dom, so maybe you can add it under mcrypt on the System Requirements entry?

Thanks.

Missing Call Counts

I've noticed when going through a stack, correct me if I'm wrong but my understanding of this is like this, the current call count should be equal to the sum of the call counts from the Parent Function section. In my application, I'm seeing instances where it says the current call count is greater than the sum of the parent function call counts.

xhgui - symbol - sample count mismatch

Other DB

Hi,

I know, you made XHGUI because you wanted to be able to use mongoDB.

my question is : is it possible to abstract it to be able to use mysql or other databases ?

I would be happy to write the mysql(i) driver.

for the short story, I wrote a mongo DB driver for your fork of xhprof a few years ago. and had a hard time doing it. I didn't make a pull request at the time because I couldn't get all aggregation methods to work with mongo. request took too long. It's funny that now you want to use only mongo.

URL View of Graph Displays Single Point

Hello, great product but may have stumbled across an issue. I did a straight clone of the repo and set up the app on my service, and I have several domains, all with the same app, feeding mongodb. I changed the header.php file in the externals folder so that URL gets the $_SERVER['SERVER_NAME'] along with the $uri instead of just the $uri.

Well, the data is being populated as expected, however the problem I'm running into is that the charts on the url view are not rendering properly. I get a chart with 2 points on the far left and that's it.

The JS data that the code is rendering to the page to graph looks like this

var graphData = [{"row_count":6,"raw_index":5.4,"date":"2014-01-17","wt":237285,"cpu":36003,"mu":2259360,"pmu":4168944}];

and the result from the mongodb aggregate function within getPercentileForUrl returns,

Array
(
    [result] => Array
        (
            [0] => Array
                (
                    [_id] => 2014-01-17
                    [row_count] => 6
                    [wall_times] => Array
                        (
                            [0] => 223810
                            [1] => 237285
                            [2] => 191848
                            [3] => 233181
                            [4] => 228890
                            [5] => 243629
                        )

                    [cpu_times] => Array
                        (
                            [0] => 36002
                            [1] => 36002
                            [2] => 28001
                            [3] => 36003
                            [4] => 36002
                            [5] => 44002
                        )

                    [mu_times] => Array
                        (
                            [0] => 2298520
                            [1] => 2259360
                            [2] => 2256872
                            [3] => 2255672
                            [4] => 2179600
                            [5] => 2227840
                        )

                    [pmu_times] => Array
                        (
                            [0] => 4168896
                            [1] => 4168944
                            [2] => 4168896
                            [3] => 4168896
                            [4] => 4168944
                            [5] => 4166640
                        )

                    [raw_index] => 5.4
                )

        )

    [ok] => 1
)

As a side note, I also had to comment out the ENV variable because I was getting errors from mongo stating unable to store empty value error consistently from the header.php file.

Thanks

Composer

Hi,

is there any plan or idea to include composer inside XHGUI ?

it would help for autoloading and inclusion of outer projects like twig

if yes, I would be happy to provide a pull request.

Improve sort links

On the main lists (url.php, index.php) sorting is done client side. This gives you an incorrect view of the data. Sorting should be done with a page request that sorts the entire data set. This will be slower but more correct.

change markers

When making changes during profiling, it would be very nice to add a marker, so that you can easily see the distinction between a change and the previous state. The marker would simple be a vertical line in the graph, so that you could see how effective your changes were.

One possible way of doing this, would be to add an additional parameter to the _profile=1&_xhchange=1 query string, so that you don't have to click a button in the UI.

Now, if you wanted to label the change, maybe a the xhchange param could be a string with a label.

Callgraph does not show child functions all the time.

The current implementation for callgraphs does not render the correct results in the following case:

<?php
class Cat
{
    public function sleep()
    {
      $u = new Rest();
      $u->zZzZz(1);
    }
}

class Man
{
    public function nap()
    {
       $u = new Rest();
       $u->zZzZz(1); 
    }
}

class Rest
{
    public function zZzZz($t)
    {
        sleep($t);
    }
}

$cat = new Cat();
$man = new Man();

$cat->sleep();
$man->nap();

will give this callgraph :

                 main
               /     \
man::nap (50%)        cat::sleep (50%)
     |                     | 
rest::zZzZz (50%)     rest:zZzZz (50%)
                           |
                       sleep (100%)

Whereas callgraph with graphviz was

                 main
               /      \
man::nap (50%)        cat::sleep (50%)
      |                    | 
rest::zZzZz (50%)     rest:zZzZz (50%)
      |                     |
      |-----sleep (100%)----|

The callgraphs no longer show all of the child functions or link multiple parents that call the same function up. It would be nice to link methods that call the same child together.

Implement configurable watch functions

Currently the watch functions shown on a profile run page is a hardcoded list that only includes strlen(). Ideally I think this feature should allow the following:

  • Allow the user to configure the functions to watch from inside the Xhgui interface.
  • Persist the watched functions (in mongo of course).
  • Add, remove view the functions that are being watched. This could all be on one page or many.
  • Create fuzzy matching patterns. I don't know if having simple *foo_bar* patterns will be enough, of if we should harness all of MongoRegex.
  • Stored watch functions should be highlighted in the existing box.

RFC - Implemenatation ideas

Hi,
I like your project and we are using in production,
some ideas...

  • Writer(external) and reader(web) should not share the same config file, they are conceptually different.
  • The writer 'd have an interface (maybe doctrine common cache) so swapping with other mechanisms as APC/Redis/MYSQL 'll become easy related to #11
  • Composerize the project vendors
  • uses PSR*

what do you think?

No CPU time or memory showing up

Hey guys,

I'm doing a presentation this Thursday in Sydney on Xhprof and want to talk about Xhgui. I've installed it all and it seems to be collecting data however... The cpu, wt, mu, pmu are 0. I've tried a few different xhprof_enable() calls but none seem to be effecting the collection.

Current settings are:

xhprof_enable(XHPROF_FLAGS_CPU | XHPROF_FLAGS_MEMORY);

What could I have missed?

Clean up global namespace

Currently utility.php puts a few global functions out, some of them have names that could collide with a host application. It would be wise to either prefix this functions, or put them into a class where they are less likely to clash with a host application.

Use 95th percentile in URL line graphs

Currently the line graphs on the URL view page use AVG() which is statistically a very bad idea. AVG() was originally used so I could get a page up and working quickly, and continue working on the graphing library. Now that the graphs are working the data should be updated to use 95th percentile values.

Add other types of watched methods

In large applications with 10000's of method calls per page, simply watching named functions is not going to help people find problem areas. It would also be nice to allow users to save simple comparison expressions. For example:

  • If the call count > 500us flag the method.
  • If the wall time / call count > 400 flag the method.

And so on, by having a simple grammer for finding expensive functions xhgui can highlight potential problem areas.

Ability to View Function Drilldowns Aggregated Runs

It is a feature that the oldest XHProf GUI has and is very useful. So far the url.php page is pretty useful. But it would be nicer to have the view of aggregated time and memory use from either all runs in the same day for a particular url, or the ones that user selected. Would that be possible?

Add compare view

It would be pretty awesome to be able to compare profiling results. And find out what changed and how much each thing changed.

Some quick user stories:

  • From the run page, I should be able to search for similar runs (based on the simple_url).
  • Once I've found another run, I should be able to generate a comparison.
  • A comparison should show:
    • Methods that have delta's in call count, wall time, cpu time and memory use.
    • Deltas should be colour coded and ordered by difference.

Allow filtering based on HTTP_HOST

May require a meta-table to avoid a horrendous cost (to get the distinct list), but it would be nice to be able to filter results based on the HTTP_HOST when multiple domains push to the same server.

Profiling CLI tools needs improvement

I tried to profile some command line tools today and I didn't get any profile data. I could have just been doing it wrong, but in theory it should work.

Callgraph should show call count beside line

Having the lines connecting function symbols vary in size based on time spent is nice, but it would also be nice to see the call count beside the connecting line. This would help bubble up valuable information about the run.

Call count labels should only display for nodes that display text by default as well, this should help prevent the graph from getting really cluttered.

Save & import profils data from files

I think a nice feature would be allowing saving xhgui profiles data into file for a later import inside mongo. I have a use case where i've some production servers who can't connect to mongodb. The idea is to profil and save data on files, have a custom script to get thoses files and import them in mongo.

I need it so i'll make it, just wondering if you think it fits xhgui main project

&amp; in url

Hello, firstly thanks for all your work!

I have &amp;-s in the url of paginations, sorting, and those urls doesn't work.

screen shot 2013-05-06 at 12 19 47

Exceptions thrown in a controller result in sadness

It would be better if exceptions thrown in the Controller showed the standard error page, rather than the current nothing.

To test try inserting throw new Exception('stuff'); as line 15 or so in Xhgui_Controller_Run

Missing dependency causes silent install failure

I am setting up XHGUI on a new machine, following the readme instructions, which are awesome. When I ran the install script, it looked like it had completely correctly, these are the last few lines:

  - Installing phpunit/php-file-iterator (1.3.3)
    Downloading: 100%         

  - Installing phpunit/php-code-coverage (1.2.12)
    Downloading: 100%         

  - Installing phpunit/phpunit (3.7.x-dev 1237d5d)
    Cloning 1237d5d94b4fdc28fd1884bd70b2096050c12391
Checking permissions for cache directory.
Permissions on cache/ are ok.

But I didn't end up with a vendor/autoload.php. So I ran composer update and one of the dependencies failed (because I don't have git installed on this machine):

$ php composer.phar update
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing phpunit/phpunit (3.7.x-dev 1237d5d)
    Cloning 1237d5d94b4fdc28fd1884bd70b2096050c12391



  [RuntimeException]                                                                                                                     
  Failed to clone https://github.com/sebastianbergmann/phpunit.git, git was not found, check that it is installed and in your PATH env.  

  sh: 1: git: not found

My system works now, I did a composer update with --no-dev, but I think the error should be visible when running the installer and I'm not sure how to capture that from the exec() call in install.php.

Implement callgraphs

Build a nice looking way for developers to look at the critical path for a profile run. This visualization should let you see the following things:

  • The critical path of the application should be highlighted.
  • The wall time and percentage of request time should be shown for each heavy functions.
  • Should look like a call tree.
  • You should be able to get a callgraph for any profile run.

Provide UI mechanism to change cut off % for callgraph

I experimented this morning with moving the line around. Graphing everything is … madness. Graphing only things that are 5% or more cut a lot of chaff. I think adding a UI button (refreshing the page would be fine IMHO) for like 0.5%, 1%, 5% would be nice.

/custom/help?id=52d5e6b0feca801f4a9c55a6 show data error

click this link
qq20140115101033

open url :
/custom/help?id=52d5e6b0feca801f4a9c55a6

then the data is not from the id:52d5e6b0feca801f4a9c55a6, but the latest data,
as the code is:

public function help()
{
$res = $this->_profiles->latest();
$this->_app->render('custom/help.twig', array(
'data' => print_r($res[0]->toArray(), 1)
));
}

and I change this funtion as :
public function help()
{
//$res = $this->_profiles->latest();
$request = $this->_app->request();
$result = $this->_profiles->get($request->get('id'));
$res = $result->toArray();
$this->_app->render('custom/help.twig', array(
'data' => print_r($res, 1)
));
}

it works fun.

can't find Class 'Xhgui_Autoload' ?

hi
I am setting up XHGUI(f9614f4) on a new machine, following the readme instructions.

I ran the install script and it looked like it had completely correctly.

then i visit the index.php in wwwroot through browser, i got an error: Fatal error:" Class 'Xhgui_Autoload' not found in /www/xhgui/src/bootstrap.php on line 8"

does anyone can help for this? thank you very much.

Composer Requirements

Hello developers,
as even your installation guide says you can use xhgui even when you do not have access to mongoDB directly. This is exactly our case - we do not want to run mongo on our production just for profiling, instead of it we would like to generate files, download them periodically and analyze locally, however we will not be able to compose this project as dependency in composer on production because this project has ext-mongo as a requirement.

It is not a requirement though as you CAN run without it and you even suggest it in the manual. Do you think it would be wise to remove this dependency? Otherwise I will need to fork :-) Thank you!

PS I forgot to show some appreciation. The project is very nice, GUI working, callgraph interactive (!) and everything works. This XHProf GUI is much better than the other ones I tried. Thanks, guys!

xhprof recommended repository

I'm currently using the original xhprof build (commit #254eb24) and not the forked one (commit #75619dc) along xhgui. Everything seems to be working correctly.

As far as I can tell, the forked repo had modifications prior to your work on the newest versions of xhgui. Can you confirm this? Is there a fork you recommend most?

My goal is to suggest a fix for what I believe to be a confusion introduced by this homebrew php formula.

url view is so slow when data is so large

1: /url/view?url=url
when records are large, this page is so slow, beacause there is no index for meta.simple_url
then add a index for db.xhprof.results:
db.results.ensureIndex( { 'meta.simple_url' : 1 } )

2: /usr/view?url=url is realy show the url cost time history, but xhgui record the url and the get paramters, for example:
a.php
a.php?id=5
a.php?id=6
these url is really the same url, but xhgui cann't display all a.php(with diffirent get parameters) in the /url/view

so I modify the external/header.php , make the meta.simple_url has no get parameters, this is the screentshot:
qq20140120141443

and then you can see the a.php graphic:
qq20140120141818

but see the graphic the show time in the red rectangle, I found the time is not 24 hours but 12 hours, if current time is 13:20, here will show you 1:20, then must modify src/Xhgui/Profiles.php , find function: getPercentileForUrl.
qq20140120142110
date('Y-m-d h:i:s', $result['_id']->sec) change as date('Y-m-d H:i:s', $result['_id']->sec)
change 'h' to uppercase 'H'

external/header.php is included with nginx

Under Nginx, there's a Constant XHGUI_ROOT_DIR already defined in /path/to/bootstrap.php error in every page.

It seems that the bootstrap.php is called twice in the code :

  • first call is from the include() in index.php, -> normal
  • second call is from recordXHProfData in external/header.php 😲

I don't know why, but something is including the external/header.php file under nginx.

PHP Fatal : Base lambda function for closure not found

There's a known issue with using PHP + APC and the usage of anonymous functions. I have several applications that I'm using this product to collect data on, and on occasions, all applications at the same time will start throwing the fatal. It's nothing to do with your code itself, it's just the way APC handles the caching of it causes the Fatal. Without the APC extension it runs fine w/o errors. This error gets thrown on the 'profile.enabled' line of the config.default.php.

https://bugs.php.net/bug.php?id=52144

Create more nuanced code to turn XHGui on

Currently the code simply generates a random number, if it's 42 the profiler is turned on, it would be nice to offer more options.

Possible Ideas:

  • Select users by IP (if the remote_addr last octet = 42 turn on profiling for a 1/255 chance) with adjustable probability.
  • Generate random number on first request, give users a cookie indicating state, so they are followed throughout their use of the site
  • Support ?_xhgui=1 and ?_xhgui=0 to give yourself a cookie to turn it on or off (see xhprof implementation)
  • Be able to configure different probabilities for different parts of the site /public = 1/100 chance, /users = 1/10 chance, /admin = 1/1 chance, /forums = 1/1000 chance

It would be desirable to profile a user throughout their use of the site to 1) make the waterfall view useful, and 2) to get a better look at the overall experience as a user sees it.

Callgraph tooltips should show more information

It would be great if tooltips on the callgraph showed the mu/pmu/cpu/wt values. Right now only the wall time is shown.

In an even more ideal world the callgraph could be generated with the circle size based off each metric through a radio button control set.

flush() can cause a warning when output buffering is enabled

In a script I see:
header('X-Bar: foo');
ob_start("ob_gzhandler");
echo $json;
exit;
With XHGui on I get [Tue Aug 13 15:01:50 2013] [error] [client 192.168.3.1] PHP Warning: Cannot modify header information - headers already sent in Unknown on line 0

If I comment out the flush() line this goes away. Need to diagnose further.

Fatal Error if Can't Connect To Mongo

I didn't have mongodb running on my machine when I tried to request webroot/index.php, and I got a 500 error with an uncaught exception:

Uncaught exception 'MongoConnectionException' with message 'Failed to connect to: localhost:27017: Transport endpoint is not connected' in .../web/Xhgui/Db.php:15

I would expect this to come back and tell me to try plugging it in first, or something else friendlier.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.