Giter VIP home page Giter VIP logo

funcmap-1's Introduction

funcmap PHP extension

Problem: how to detect unused/dead legacy functions in production code? Solution: collect all the functions that ARE used and remove them from the list of functions available. What's left is unused.

funcmap is a simple PHP extension that collects names of all userspace functions that's been called and writes them down to a text file from time to time. To reduce the resource usage, you can limit the probability of that event.

Configuration

  • funcmap.enabled bool (PHP_INI_SYSTEM) - enable/disable the extension. The extension won't do anything at all if this setting is set to false. Default value: false
  • funcmap.logfile string (PHP_INI_ALL) - path to the logfile. File must be writable by PHP process user, otherwise you'll get an error in the logs. The filename may contain '%pid%' pattern, so that each child could write to its own file. Adding the '%pid%' pattern is strongly recommended for multiprocess PHP installations, otherwise you'll most likely end up with garbage results. Default value: ""
  • funcmap.probability int (PHP_INI_SYSTEM) - enable data collection with this probability. This is probablity in percents, so any valuu greater than 100 will be treated as 100, i.e. "always enabled". Setting it to a value <= 0 will result in no data being written ever. Default value: 100
  • funcmap.flush_interval_sec int (PHP_INI_ALL) - write collected data to the disk each N seconds (and on process shutdown). Zero value means "write on process shutdown only" (PHP-FPM processes are shut down, for example, when they reach their request limit). Default value: 0

Example configuration

funcmap.enabled=1                            # enable the extension
funcmap.logfile=/tmp/logs/funcmap_%pid%.log  # each PHP process writes to its own log file
funcmap.flush_interval_sec=200               # write data each 200 seconds if the process lives longer than that
funcmap.probability=2                        # collect data for 2% script executions only

funcmap-1's People

Contributors

tony2001 avatar

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.