8000 perf-tools/tools/reset-ftrace at master · wadia/perf-tools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
{"payload":{"allShortcutsEnabled":false,"fileTree":{"tools":{"items":[{"name":"reset-ftrace","path":"tools/reset-ftrace","contentType":"file"}],"totalCount":1},"":{"items":[{"name":"bin","path":"bin","contentType":"directory"},{"name":"deprecated","path":"deprecated","contentType":"directory"},{"name":"disk","path":"disk","contentType":"directory"},{"name":"examples","path":"examples","contentType":"directory"},{"name":"kernel","path":"kernel","contentType":"directory"},{"name":"man","path":"man","contentType":"directory"},{"name":"misc","path":"misc","contentType":"directory"},{"name":"net","path":"net","contentType":"directory"},{"name":"system","path":"system","contentType":"directory"},{"name":"tools","path":"tools","contentType":"directory"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"execsnoop","path":"execsnoop","contentType":"file"},{"name":"iolatency","path":"iolatency","contentType":"file"},{"name":"iosnoop","path":"iosnoop","contentType":"file"},{"name":"killsnoop","path":"killsnoop","contentType":"file"},{"name":"opensnoop","path":"opensnoop","contentType":"file"},{"name":"syscount","path":"syscount","contentType":"file"}],"totalCount":18}},"fileTreeProcessingTime":12.001051,"foldersToFetch":[],"incompleteFileTree":false,"repo":{"id":27256354,"defaultBranch":"master","name":"perf-tools","ownerLogin":"wadia","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2014-11-28T07:31:13.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/72026?v=4","public":true,"private":false,"isOrgOwned":false},"codeLineWrapEnabled":false,"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"master","listCacheKey":"v0:1616583486.855468","canEdit":false,"refType":"branch","currentOid":"2dd02b6f3611e0d609e5bda64b77416fac737983"},"path":"tools/reset-ftrace","currentUser":null,"blob":{"rawLines":["#!/bin/bash","#","# reset-ftrace - reset state of ftrace, disabling all tracing.","# Written for Linux ftrace.","#","# This may only be of use to ftrace hackers who, in the process of developing","# ftrace software, often get the subsystem into a partially active state, and","# would like a quick way to reset state. Check the end of this script for the","# actually files reset, and add more if you need.","#","# USAGE: ./reset-ftrace [-fhq]","#","# REQUIREMENTS: FTRACE CONFIG.","#","# From perf-tools: https://github.com/brendangregg/perf-tools","#","# See the reset-ftrace(8) man page (in perf-tools) for more info.","#","# COPYRIGHT: Copyright (c) 2014 Brendan Gregg.","#","# This program is free software; you can redistribute it and/or","# modify it under the terms of the GNU General Public License","# as published by the Free Software Foundation; either version 2","# of the License, or (at your option) any later version.","#","# This program is distributed in the hope that it will be useful,","# but WITHOUT ANY WARRANTY; without even the implied warranty of","# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the","# GNU General Public License for more details.","#","# You should have received a copy of the GNU General Public License","# along with this program; if not, write to the Free Software Foundation,","# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.","#","# (http://www.gnu.org/copyleft/gpl.html)","#","# 20-Jul-2014\tBrendan Gregg\tCreated this.","","tracing=/sys/kernel/debug/tracing","flock=/var/tmp/.ftrace-lock","opt_force=0; opt_quiet=0","","function usage {","\tcat \u003c\u003c-END \u003e\u00262","\tUSAGE: reset-ftrace [-fhq]","\t -f # force: delete ftrace lock file","\t -q # quiet: reset, but say nothing","\t -h # this usage message","\t eg,","\t reset-ftrace # disable active ftrace session","END","\texit","}","","function warn {","\tif ! eval \"$@\"; then","\t\techo \u003e\u00262 \"WARNING: command failed \\\"$@\\\"\"","\tfi","}","","function die {","\techo \u003e\u00262 \"$@\"","\texit 1","}","","function vecho {","\t(( opt_quiet )) \u0026\u0026 return","\techo \"$@\"","}","","# write to file","function writefile {","\tfile=$1","\tstring=$2\t# optional","\tif [[ ! -w $file ]]; then","\t\techo \u003e\u00262 \"WARNING: file $file not writable/exists. Skipping.\"","\t\treturn","\tfi","\tvecho \"$file, before:\"","\t(( ! opt_quiet )) \u0026\u0026 cat -n $file","\twarn \"echo $string \u003e $file\"","\tvecho \"$file, after:\"","\t(( ! opt_quiet )) \u0026\u0026 cat -n $file","\tvecho","}","","### process options","while getopts fhq opt","do","\tcase $opt in","\tf)\topt_force=1 ;;","\tq)\topt_quiet=1 ;;","\th|?)\tusage ;;","\tesac","done","shift $(( $OPTIND - 1 ))","","### ftrace lock","if [[ -e $flock ]]; then","\tif (( opt_force )); then","\t\twarn rm $flock","\telse","\t\techo -e \u003e\u00262 \"ERROR: ftrace lock ($flock) exists. It shows\" \\","\t\t \"ftrace may be in use by PID $(cat $flock).\\nDouble check\" \\","\t\t \"to see if that PID is still active. If not, consider\" \\","\t\t \"using -f to force a reset. Exiting.\"","\t\texit 1","\tfi","fi","","### reset ftrace state","vecho \"Reseting ftrace state...\"","vecho","cd $tracing || die \"ERROR: accessing tracing. Root user? Kernel has FTRACE?\"","writefile current_tracer nop","writefile set_ftrace_filter","writefile set_graph_function","writefile set_ftrace_pid","writefile events/enable 0","writefile tracing_thresh 0","writefile kprobe_events","writefile tracing_on 1","vecho \"Done.\""],"stylingDirectives":null,"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/wadia/perf-tools/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"reset-ftrace","displayUrl":"https://github.com/wadia/perf-tools/blob/master/tools/reset-ftrace?raw=true","headerInfo":{"blobSize":"3.18 KB","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":"https://desktop.github.com","isGitLfs":false,"onBranch":true,"shortPath":"7c0d403","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fwadia%2Fperf-tools%2Fblob%2Fmaster%2Ftools%2Freset-ftrace","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"123","truncatedSloc":"114"},"mode":"executable file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"Shell","languageID":346,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/wadia/perf-tools/blob/master/tools/reset-ftrace","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/wadia/perf-tools/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/wadia/perf-tools/raw/refs/heads/master/tools/reset-ftrace","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":null},"copilotInfo":null,"copilotAccessAllowed":false,"modelsAccessAllowed":false,"modelsRepoIntegrationEnabled":false,"csrf_tokens":{"/wadia/perf-tools/branches":{"post":"e8eulcrvZ7SoYIC15-Jwot6DaEnw8veJWnoSTL0xlEf_LMWUYI9xuZ7IvtMcYpD5u0yZ_3Ju9Ek0w5e4p_7r7g"},"/repos/preferences":{"post":"yIswEOoCNXN9KAe9iy12AT1qgSKPGlFApZSRBfUTGDbr3_3k8cL6NrNyfUudfPqSlswgSSE3QbydYk3yeApxPA"}}},"title":"perf-tools/tools/reset-ftrace at master · wadia/perf-tools","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-263cab1760dd.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-1b17b3e7786a.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true}}}
0