{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Run a statement through the python code profiler."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Strong",
              "__tag": 4048,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Usage, in line mode"
                }
              ]
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "    "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "%prun [options] statement",
          "execution_status": null,
          "out": ""
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Strong",
              "__tag": 4048,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Usage, in cell mode"
                }
              ]
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "    "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "%%prun [options] [statement]\ncode...\ncode...",
          "execution_status": null,
          "out": ""
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "In cell mode, the additional code lines are appended to the (possibly empty) statement in the first line.  Cell mode allows you to easily profile multiline blocks without having to put them in a separate function."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The given statement (which doesn't require quote marks) is run via the python profiler in a manner similar to the profile.run() function. Namespaces are internally managed to work correctly; profile.run cannot be used in IPython because it makes certain assumptions about namespaces which do not hold under IPython."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Options:"
            }
          ]
        },
        {
          "__type": "DefList",
          "__tag": 4033,
          "children": [
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Text",
                    "__tag": 4046,
                    "value": "-l <limit>"
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "you can place restrictions on what or how much of the   profile gets printed. The limit value can be:"
                    }
                  ]
                },
                {
                  "__type": "Blockquote",
                  "__tag": 4059,
                  "children": [
                    {
                      "__type": "BulletList",
                      "__tag": 4053,
                      "ordered": false,
                      "start": 1,
                      "children": [
                        {
                          "__type": "ListItem",
                          "__tag": 4054,
                          "children": [
                            {
                              "__type": "Paragraph",
                              "__tag": 4045,
                              "children": [
                                {
                                  "__type": "Text",
                                  "__tag": 4046,
                                  "value": "A string: only information for function names containing this string        is printed."
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "__type": "ListItem",
                          "__tag": 4054,
                          "children": [
                            {
                              "__type": "Paragraph",
                              "__tag": 4045,
                              "children": [
                                {
                                  "__type": "Text",
                                  "__tag": 4046,
                                  "value": "An integer: only these many lines are printed."
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "__type": "ListItem",
                          "__tag": 4054,
                          "children": [
                            {
                              "__type": "Paragraph",
                              "__tag": 4045,
                              "children": [
                                {
                                  "__type": "Text",
                                  "__tag": 4046,
                                  "value": "A float (between 0 and 1): this fraction of the report is printed        (for example, use a limit of 0.4 to see the topmost 40% only)."
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "You can combine several limits with repeated use of the option. For   example, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "-l __init__ -l 5"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " will print only the topmost 5 lines of   information about class constructors."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Text",
                    "__tag": 4046,
                    "value": "-r"
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "return the pstats.Stats object generated by the profiling. This   object has all the information about the profile in it, and you can   later use it for further analysis or in other functions."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Text",
                    "__tag": 4046,
                    "value": "-s <key>"
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "sort profile by given key. You can provide more than one key   by using the option several times: '-s key1 -s key2 -s key3...'. The   default sorting key is 'time'."
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The following is copied verbatim from the profile documentation   referenced below:"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "When more than one key is provided, additional keys are used as   secondary criteria when the there is equality in all keys selected   before them."
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Abbreviations can be used for any key names, as long as the   abbreviation is unambiguous.  The following are the keys currently   defined:"
                    }
                  ]
                },
                {
                  "__type": "Code",
                  "__tag": 4050,
                  "value": "============  =====================\nValid Arg     Meaning\n============  =====================\n\"calls\"       call count\n\"cumulative\"  cumulative time\n\"file\"        file name\n\"module\"      file name\n\"pcalls\"      primitive call count\n\"line\"        line number\n\"name\"        function name\n\"nfl\"         name/file/line\n\"stdname\"     standard name\n\"time\"        internal time\n============  =====================",
                  "execution_status": null,
                  "out": ""
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Note that all sorts on statistics are in descending order (placing   most time consuming items first), where as name, file, and line number   searches are in ascending order (i.e., alphabetical). The subtle   distinction between \"nfl\" and \"stdname\" is that the standard name is a   sort of the name as printed, which means that the embedded line   numbers get compared in an odd way.  For example, lines 3, 20, and 40   would (if the file names were the same) appear in the string order   \"20\" \"3\" and \"40\".  In contrast, \"nfl\" does a numeric compare of the   line numbers.  In fact, sort_stats(\"nfl\") is the same as   sort_stats(\"name\", \"file\", \"line\")."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Text",
                    "__tag": 4046,
                    "value": "-T <filename>"
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "save profile results as shown on screen to a text   file. The profile is still shown on screen."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Text",
                    "__tag": 4046,
                    "value": "-D <filename>"
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "save (via dump_stats) profile statistics to given   filename. This data is in a format understood by the pstats module, and   is generated by a call to the dump_stats() method of profile   objects. The profile is still shown on screen."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Text",
                    "__tag": 4046,
                    "value": "-q"
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "suppress output to the pager.  Best used with -T and/or -D above."
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If you want to run complete programs under the profiler's control, use "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "%run -p [prof_opts] filename.py [args to program]"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " where prof_opts contains profiler specific options as described here."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "You can read the complete documentation for the profile module with    "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "In [1]: import profile; profile.help()",
          "execution_status": null,
          "out": ""
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "versionchanged",
          "base_type": "neutral",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "versionchanged 7.3"
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "User variables are no longer expanded, the magic line is always left unmodified."
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": "/IPython/core/magics/execution.py",
  "item_line": 202,
  "item_type": "function",
  "aliases": [
    "IPython.core.magics.ExecutionMagics.prun"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "self",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "parameter_s",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": ""
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "cell",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "prun"
  },
  "references": null,
  "qa": "IPython.core.magics.execution:ExecutionMagics.prun",
  "arbitrary": [],
  "local_refs": []
}