clockwork

授权协议 MIT License
开发语言 PHP
所属分类 程序开发、 日志工具(Logging)
软件类型 开源软件
地区 不详
投 递 者 於鸿羲
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Clockwork is a development tool for PHP available right in your browser. Clockwork gives you an insight into your application runtime - including request data, performance metrics, log entries, database queries, cache queries, redis commands, dispatched events, queued jobs, rendered views and more - for HTTP requests, commands, queue jobs and tests.

This repository contains the server-side component of Clockwork.

Check out on the Clockwork website for details.

Installation

Install the Clockwork library via Composer.

$ composer require itsgoingd/clockwork

Congratulations, you are done! To enable more features like commands or queue jobs profiling, publish the configuration file via the vendor:publish Artisan command.

Note: If you are using the Laravel route cache, you will need to refresh it using the route:cache Artisan command.

Read full installation instructions on the Clockwork website.

Features

Collecting data

The Clockwork server-side component collects and stores data about your application.

Clockwork is only active when your app is in debug mode by default. You can choose to explicitly enable or disable Clockwork, or even set Clockwork to always collect data without exposing them for further analysis.

We collect a whole bunch of useful data by default, but you can enable more features or disable features you don't need in the config file.

Some features might allow for advanced options, eg. for database queries you can set a slow query threshold or enable detecting of duplicate (N+1) queries. Check out the config file to see all what Clockwork can do.

There are several options that allow you to choose for which requests Clockwork is active.

On-demand mode will collect data only when Clockwork app is open. You can even specify a secret to be set in the app settings to collect request. Errors only will record only requests ending with 4xx and 5xx responses. Slow only will collect only requests with responses above the set slow threshold. You can also filter the collected and recorded requests by a custom closure. CORS pre-flight requests will not be collected by default.

New in Clockwork 4.1, artisan commands, queue jobs and tests can now also be collected, you need to enable this in the config file.

Clockwork also collects stack traces for data like log messages or database queries. Last 10 frames of the trace are collected by default. You can change the frames limit or disable this feature in the configuration file.

Viewing data

Web interface

Open your.app/clockwork to view and interact with the collected data.

The app will show all executed requests, which is useful when the request is not made by browser, but for example a mobile application you are developing an API for.

Browser extension

A browser dev tools extension is also available for Chrome and Firefox:

Toolbar

Clockwork now gives you an option to show basic request information in the form of a toolbar in your app.

The toolbar is fully rendered client-side and requires installing a tiny javascript library.

Learn more on the Clockwork website.

Logging

You can log any variable via the clock() helper, from a simple string to an array or object, even multiple values:

clock(User::first(), auth()->user(), $username)

The clock() helper function returns it's first argument, so you can easily add inline debugging statements to your code:

User::create(clock($request->all()))

If you want to specify a log level, you can use the long-form call:

clock()->info("User {$username} logged in!")

Timeline

Timeline gives you a visual representation of your application runtime.

To add an event to the timeline - start it with a description, execute the tracked code and finish the event. A fluent api is available to further configure the event.

// using timeline api with begin/end and fluent configuration
clock()->event('Importing tweets')->color('purple')->begin();
    ...
clock()->event('Importing tweets')->end();

Alternatively you can execute the tracked code block as a closure. You can also choose to use an array based configuration instead of the fluent api.

// using timeline api with run and array-based configuration
clock()->event('Updating cache', [ 'color' => 'green' ])->run(function () {
    ...
});

Read more about available features on the Clockwork website.

  • Rabbits are small mammals in the family Lep or idae of the or der Lagom or pha. So says Wikipedia. C or rectly. The c or ollary is that they are not b or ing, f or they are all or iginal and well or g

  • What is Clockwork? Clockwork is a browser extension, providing tools for debugging and profiling your PHP applications, including request data, application log, database queries, routes, visualisation

  • 题目 题目描述 My name is James diGriz, I’m the most clever robber and treasure hunter in the whole galaxy. There are books written about my adventures and songs about my operations, though you were able to

  • 正题 题目链接:https://www.luogu.com.cn/problem/CF650E 题目大意 给出 n n n个点的两棵树,你每次可以选择第一棵树上的一条边改成另一条边,但是改完之后必须还是一棵树,求最少的步数把第一棵树改成第二棵树。 1 ≤ n ≤ 5 × 1 0 5 1\leq n\leq 5\times 10^5 1≤n≤5×105 解题思路 难点在于不能形成环,所以我们肯定不能

  • Description 给出两棵 n 结点的有标号树。 每次操作删去第一棵树的一条边,再加上一条边,需要保证此时还是一棵树。 构造一种操作序列,将第一棵树变成第二棵树,使得操作数最小。 n ≤ 5 × 1 0 5 5 \times 10^5 5×105 Solution 显然,对于第一颗树的边 x ↔ y x \leftrightarrow y x↔y,如果这条边在第二颗树中也存在,那么是不可能更

  • 题目描述 Rabbits are small mammals in the family Lep or idae of the or der Lagom or pha. So says Wikipedia. C or rectly. The c or ollary is that they are not b or ing, f or they are all or iginal and well

  • 非常好的一道题 首先很容易想到当你拆一条边后加边的次序是随意的 然后我们可以这么想:如果在两个图中都存在的边没有任何意义,所以我们可以在结果图中先把相同边留下,把其他边删去,怎么弄呢,如果是一棵树就好办了,所以剩下就是把一堆树连起来。然后考虑开始的图,对于在结束图中不存在的边我们把它也删了,然后就是从当前节点出发有联通快,这些联通块在第二张图里面也存在,所以下面很简单了,我们只要把当前联通块的祖先

  • clockwork对于曾经做过C,c++代码调优的工程师并不会陌生,它可以指出代码中的潜在问题,比如内存泄漏,数组越界等。他也可以做profiler动作,指出系统各个函数的执行时间,性能瓶颈到底在哪里等。 而在PHP服务端开发中,同样存在类似的需求。比如为什么我们的PHP代码执行如此之慢?时间到底花到哪里去了?数据库访问到底花了多少query?是否可以对数据库的操作做一下优化,减少对数据库的访问次

  • 题意:有两棵树,现在可以将第一棵树的边去除,然后在两个节点之间连一条新边使得第一棵树变成第二棵树,但是这种操作有一个限制条件,就是任何时刻,图中不能出现环,问操作数最少的步骤。 思路:首先可以明确一点,就是一定存在某种操作序列,使得第一棵树变成第二棵树。考虑两棵树之间相同的边,可以把这些边包含的点缩成一个点考虑,要在这两个缩点后的图上进行操作,只需要每次从树的叶子节点开始改边就能保证满足题目中没有

  • 题意 给你两棵大小为n的树,每次操作可以把第一棵树的一条边删掉然后加上另一条边,且满足操作完之后仍是一棵树。问最少需要多少步操作才能把第一棵树变成第二棵树并输出方案。 n<=500000 分析 如果我们每次随便选一条在第二棵树中出现但不在第一棵树中出现的边,设为(x,y),那么第一棵树中x到y路径上必然存在一条边满足其只在第一棵树中出现。 很自然的想法就是去维护这个东西,然后我比赛的时候敲了1h的

  • E. Clockwork Bomb 题目连接: http://www.codeforces.com/contest/650/problem/E Description My name is James diGriz, I'm the most clever robber and treasure hunter in the whole galaxy. There are books written

  • time limit per test 6 seconds memory limit per test 256 megabytes input standard input output standard output My name is James diGriz, I’m the most clever robber and treasure hunter in the whole galax

相关阅读

相关文章

相关问答

相关文档