{
    "content": [
        {
            "type": "text",
            "text": "# DBI::ProfileDumper (perldoc)\n\n## NAME\n\nDBI::ProfileDumper - profile DBI usage and output data to a file\n\n## SYNOPSIS\n\nTo profile an existing program using DBI::ProfileDumper, set the DBIPROFILE environment\nvariable and run your program as usual. For example, using bash:\nDBIPROFILE=2/DBI::ProfileDumper program.pl\nThen analyze the generated file (dbi.prof) with dbiprof:\ndbiprof\nYou can also activate DBI::ProfileDumper from within your code:\nuse DBI;\n# profile with default path (2) and output file (dbi.prof)\n$dbh->{Profile} = \"!Statement/DBI::ProfileDumper\";\n# same thing, spelled out\n$dbh->{Profile} = \"!Statement/DBI::ProfileDumper/File:dbi.prof\";\n# another way to say it\nuse DBI::ProfileDumper;\n$dbh->{Profile} = DBI::ProfileDumper->new(\nPath => [ '!Statement' ],\nFile => 'dbi.prof' );\n# using a custom path\n$dbh->{Profile} = DBI::ProfileDumper->new(\nPath => [ \"foo\", \"bar\" ],\nFile => 'dbi.prof',\n);\n\n## DESCRIPTION\n\nDBI::ProfileDumper is a subclass of DBI::Profile which dumps profile data to disk instead of\nprinting a summary to your screen. You can then use dbiprof to analyze the data in a number of\ninteresting ways, or you can roll your own analysis using DBI::ProfileData.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **USAGE**\n- **METHODS** (1 subsections)\n- **DATA FORMAT**\n- **AUTHOR**\n- **COPYRIGHT AND LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "DBI::ProfileDumper",
        "section": "",
        "mode": "perldoc",
        "summary": "DBI::ProfileDumper - profile DBI usage and output data to a file",
        "synopsis": "To profile an existing program using DBI::ProfileDumper, set the DBIPROFILE environment\nvariable and run your program as usual. For example, using bash:\nDBIPROFILE=2/DBI::ProfileDumper program.pl\nThen analyze the generated file (dbi.prof) with dbiprof:\ndbiprof\nYou can also activate DBI::ProfileDumper from within your code:\nuse DBI;\n# profile with default path (2) and output file (dbi.prof)\n$dbh->{Profile} = \"!Statement/DBI::ProfileDumper\";\n# same thing, spelled out\n$dbh->{Profile} = \"!Statement/DBI::ProfileDumper/File:dbi.prof\";\n# another way to say it\nuse DBI::ProfileDumper;\n$dbh->{Profile} = DBI::ProfileDumper->new(\nPath => [ '!Statement' ],\nFile => 'dbi.prof' );\n# using a custom path\n$dbh->{Profile} = DBI::ProfileDumper->new(\nPath => [ \"foo\", \"bar\" ],\nFile => 'dbi.prof',\n);",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 31,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "USAGE",
                "lines": 22,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 10,
                "subsections": [
                    {
                        "name": "flush_to_disk",
                        "lines": 20
                    }
                ]
            },
            {
                "name": "DATA FORMAT",
                "lines": 34,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND LICENSE",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "DBI::ProfileDumper - profile DBI usage and output data to a file\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "To profile an existing program using DBI::ProfileDumper, set the DBIPROFILE environment\nvariable and run your program as usual. For example, using bash:\n\nDBIPROFILE=2/DBI::ProfileDumper program.pl\n\nThen analyze the generated file (dbi.prof) with dbiprof:\n\ndbiprof\n\nYou can also activate DBI::ProfileDumper from within your code:\n\nuse DBI;\n\n# profile with default path (2) and output file (dbi.prof)\n$dbh->{Profile} = \"!Statement/DBI::ProfileDumper\";\n\n# same thing, spelled out\n$dbh->{Profile} = \"!Statement/DBI::ProfileDumper/File:dbi.prof\";\n\n# another way to say it\nuse DBI::ProfileDumper;\n$dbh->{Profile} = DBI::ProfileDumper->new(\nPath => [ '!Statement' ],\nFile => 'dbi.prof' );\n\n# using a custom path\n$dbh->{Profile} = DBI::ProfileDumper->new(\nPath => [ \"foo\", \"bar\" ],\nFile => 'dbi.prof',\n);\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "DBI::ProfileDumper is a subclass of DBI::Profile which dumps profile data to disk instead of\nprinting a summary to your screen. You can then use dbiprof to analyze the data in a number of\ninteresting ways, or you can roll your own analysis using DBI::ProfileData.\n\nNOTE: For Apache/modperl applications, use DBI::ProfileDumper::Apache.\n",
                "subsections": []
            },
            "USAGE": {
                "content": "One way to use this module is just to enable it in your $dbh:\n\n$dbh->{Profile} = \"1/DBI::ProfileDumper\";\n\nThis will write out profile data by statement into a file called dbi.prof. If you want to modify\neither of these properties, you can construct the DBI::ProfileDumper object yourself:\n\nuse DBI::ProfileDumper;\n$dbh->{Profile} = DBI::ProfileDumper->new(\nPath => [ '!Statement' ],\nFile => 'dbi.prof'\n);\n\nThe \"Path\" option takes the same values as in DBI::Profile. The \"File\" option gives the name of\nthe file where results will be collected. If it already exists it will be overwritten.\n\nYou can also activate this module by setting the DBIPROFILE environment variable:\n\n$ENV{DBIPROFILE} = \"!Statement/DBI::ProfileDumper\";\n\nThis will cause all DBI handles to share the same profiling object.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "The following methods are available to be called using the profile object. You can get access to\nthe profile object from the Profile key in any DBI handle:\n\nmy $profile = $dbh->{Profile};\n\nflushtodisk\n$profile->flushtodisk()\n\nFlushes all collected profile data to disk and empties the Data hash. Returns the filename\nwritten to. If no profile data has been collected then the file is not written and",
                "subsections": [
                    {
                        "name": "flush_to_disk",
                        "content": "The file is locked while it's being written. A process 'consuming' the files while they're being\nwritten to, should rename the file first, then lock it, then read it, then close and delete it.\nThe \"DeleteFiles\" option to DBI::ProfileData does the right thing.\n\nThis method may be called multiple times during a program run.\n\nempty\n$profile->empty()\n\nClears the Data hash without writing to disk.\n\nfilename\n$filename = $profile->filename();\n\nGet or set the filename.\n\nThe filename can be specified as a CODE reference, in which case the referenced code should\nreturn the filename to be used. The code will be called with the profile object as its first\nargument.\n"
                    }
                ]
            },
            "DATA FORMAT": {
                "content": "The data format written by DBI::ProfileDumper starts with a header containing the version number\nof the module used to generate it. Then a block of variable declarations describes the profile.\nAfter two newlines, the profile data forms the body of the file. For example:\n\nDBI::ProfileDumper 2.003762\nPath = [ '!Statement', '!MethodName' ]\nProgram = t/42profiledata.t\n\n+ 1 SELECT name FROM users WHERE id = ?\n+ 2 prepare\n= 1 0.0312958955764771 0.000490069389343262 0.000176072120666504 0.00140702724456787 1023115819.83019 1023115819.86576\n+ 2 execute\n1 0.0312958955764771 0.000490069389343262 0.000176072120666504 0.00140702724456787 1023115819.83019 1023115819.86576\n+ 2 fetchrowhashref\n= 1 0.0312958955764771 0.000490069389343262 0.000176072120666504 0.00140702724456787 1023115819.83019 1023115819.86576\n+ 1 UPDATE users SET name = ? WHERE id = ?\n+ 2 prepare\n= 1 0.0312958955764771 0.000490069389343262 0.000176072120666504 0.00140702724456787 1023115819.83019 1023115819.86576\n+ 2 execute\n= 1 0.0312958955764771 0.000490069389343262 0.000176072120666504 0.00140702724456787 1023115819.83019 1023115819.86576\n\nThe lines beginning with \"+\" signs signify keys. The number after the \"+\" sign shows the nesting\nlevel of the key. Lines beginning with \"=\" are the actual profile data, in the same order as in\nDBI::Profile.\n\nNote that the same path may be present multiple times in the data file since \"format()\" may be\ncalled more than once. When read by DBI::ProfileData the data points will be merged to produce a\nsingle data set for each distinct path.\n\nThe key strings are transformed in three ways. First, all backslashes are doubled. Then all\nnewlines and carriage-returns are transformed into \"\\n\" and \"\\r\" respectively. Finally, any NULL\nbytes (\"\\0\") are entirely removed. When DBI::ProfileData reads the file the first two\ntransformations will be reversed, but NULL bytes will not be restored.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Sam Tregar <sam@tregar.com>\n",
                "subsections": []
            },
            "COPYRIGHT AND LICENSE": {
                "content": "Copyright (C) 2002 Sam Tregar\n\nThis program is free software; you can redistribute it and/or modify it under the same terms as\nPerl 5 itself.\n",
                "subsections": []
            }
        }
    }
}