An open API service indexing awesome lists of open source software.

https://github.com/evilfreelancer/xhprof-ui-js

Modern, flexible and mobile friendly application for analyzing PHP XHProf dumps
https://github.com/evilfreelancer/xhprof-ui-js

javascript meterial-ui react redux xhprof xhprof-ui

Last synced: 7 months ago
JSON representation

Modern, flexible and mobile friendly application for analyzing PHP XHProf dumps

Awesome Lists containing this project

README

          

# XHProf-UI.js

Modern, flexible and Mobile friendly UI for
viewing [XHProf](https://github.com/longxinH/xhprof) dumps.

| Desktop | Mobile |
|---------|--------|
|![Main Window Dektop](./images/main-window.jpg)|![Main Window Mobile](./images/main-window-mobile.jpg)|

## Table of Contents

* [Features](#Features)
* [Selecting visible columns](#Selecting-visible-columns)
* [Searching and filtering](#Searching-and-filtering)
* [Order by column](#Order-by-column)
* [Pagination](#Pagination)
* [How to install](#How-to-install)
* [Other](#Other)

## Features

The main idea of this application is to make it possible to read dumps
of the XHProf profiler without installing setting up a database, an
interpretator on a backend, and so on.

All you need is a browser and the XHProf's dump files.

Because IT "things" should be as simple as possible!

Plus, the existing systems for viewing XHProf files do not support
mobile devices, but of course, you may open legacy XHProf UI or LiveProf
or any other systems on mobile, but the UI will cause a headache because
these systems are optimized only for desktops. But sometimes you really
want to download a dump file from the Slack and just quickly watch it on
your mobile phone :)

### Selecting visible columns

Sometimes you need just check Wall Time in combination with amount of
function Calls, on exists XHProf viewers you can't turn off not required
columns, but this app support this feature.

Button which opens this modal can be found on the left side of a main menu.

| Desktop | Mobile |
|---------|--------|
|![Columns Dektop](./images/columns.jpg)|![Columns Mobile](./images/columns-mobile.jpg)|

### Searching and filtering

If you need a filter by function just click on the required function,
if you don't know the full name of a function, then you may find it via
search.

| Desktop | Mobile |
|---------|--------|
|![Filter Dektop](./images/filter.jpg)|![Filter Mobile](./images/filter-mobile.jpg)|

### Order by column

The application may order XHProf results in ASC and DESC order,
just click to column at table header.

### Pagination

On "desktop view" at the left bottom corner of the application you may find a pagination component.

On "mobile view" in top menu you may find "book" icon, this icon opens a pagination modal.

| Desktop | Mobile |
|---------|--------|
|![Pagination Dektop](./images/pagination.jpg)|![Pagination Mobile](./images/pagination-mobile.jpg)|

## How to install

Clone the repo, then in the project directory you can run:

```shell
npm install
```

This command will install required packages described in
[package.json](./package.json) and [package-lock.json](./package-lock.json).

Then run the app in the development mode:

```shell
npm start
```

Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

But in case if you need deployable application instead of `npm start` us this:

```shell
npm run build
```

This command build the app for production to the `build` folder.

## Usage
How to save xhprof data in the correct format for this tool:
```
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);

//your code to analyze here

$xhprof_data = xhprof_disable();

file_put_contents('/tmp/xhprof.json', json_encode($xhprof_data));
```

## Other

This application created using following technologies:

* [React](https://reactjs.org/)
* [Redux](https://redux.js.org/)
* [Material UI](https://mui.com/)