Comments (8)
First I've heard of that being "canonical".
It starts with #!/usr/bin/perl -w
. env doesn't pass in the -w, so it would need a "use warnings;". You sure env is in /usr/bin/env on all OSes, and not /bin/env? env also spawns a new process (won't matter much for this tool, since its execution time should dwarf it). There's probably more, but that's what I remember off-hand.
I'm not saying I'm opposed to the change, just it's not as simple as it might seem.
from flamegraph.
(Perhaps "canonical" was the wrong word, I meant to imply "portable.")
You sure env is in /usr/bin/env on all OSes, and not /bin/env?
It is my understanding that /usr/bin/env
exists for portability reasons, and I haven't seen any UNIX flavor yet that doesn't ship with env
in /usr/bin
, precisely because so many interpreted scripts rely on this lookup mechanism. (By the way, another anchored binary is /bin/sh
, for the same reason.)
I see the pain that this causes, in particular in combination with Perl. But if switching to use warnings
to make env
happy is not a deal-breaker, I think we'll end up with a more portable set of scripts. The indirection of spawning through env
seems negligible to me.
from flamegraph.
Ubuntu Xenial:
$ ls -l /bin/env /usr/bin/env
ls: cannot access '/bin/env': No such file or directory
-rwxr-xr-x 1 root root 31408 Feb 18 2016 /usr/bin/env
Amazon Linux:
$ ls -l /bin/env /usr/bin/env
-rwxr-xr-x 1 root root 28128 Aug 6 2015 /bin/env
lrwxrwxrwx 1 root root 13 Nov 25 2015 /usr/bin/env -> ../../bin/env
Fedora 25:
$ ls -li /bin/env /usr/bin/env
121194 -rwxr-xr-x. 1 root root 32520 Jul 19 2016 /bin/env
121194 -rwxr-xr-x. 1 root root 32520 Jul 19 2016 /usr/bin/env
Weird, huh!
That's just the first three systems I've tried. /usr/bin/env exists on all three, but the way it exists isn't standard.
from flamegraph.
I don't have any other systems to try right now, so I'll accept that /usr/bin/env is everywhere, and changing it would be fine.
from flamegraph.
Yeah, a lot of systems have to do some path tweaking to make available /usr/bin/env
. But it's always there!
I'm close to submitting a PR as of https://github.com/mavam/FlameGraph/commit/69f275e035a149b56881622b200320c2051f482a, except that I don't have a good idea how to migrate use of perl -s
. (See the comments there for details.)
from flamegraph.
nudge
from flamegraph.
I'd be all for it (else a PR[1] with a sed replace implementation might get proposed), while it isn't a standard, it's used enough to warrant a wiki section dedicated to it[2].
[1] mit-pdos/xv6-public#50
[2] https://en.wikipedia.org/wiki/Shebang_(Unix)#Portability
from flamegraph.
I recently learned the hard way that env breaks other observability tools. flamegraph.pl can consume CPU resources, and if it does, it shows up as "flamegraph.pl" in top(1). With env, it would show up as "perl". This either slows down debugging (if the user is SSH'd to the instance they then need to inspect the arguments) or could break it (post mortem debugging where only process names are captured in monitoring tools).
from flamegraph.
Related Issues (20)
- stackcollapse-perf.pl should be more memory-efficient HOT 3
- FlameGraph output is always only two lines
- Flame graph enhancement (feature request)
- How to use with kernel v2.6.32?
- How to generate mixed hot/cold flame graph HOT 1
- flamegraph.pl search() function erroneusly counts hidden frames
- Flamegraph handles multi-thread program abnormality HOT 1
- Failure on `Hello, world!` with `ERROR No stack counts found` HOT 2
- Error while using stack collapse for pmc on freebsd
- bjdump: /tmp/perf-$pid.map: File format not recognized ▒
- Capturing stacks on Amazon Linux 2 kernel 4.14 and 5.10 HOT 1
- Segment Fault and report errors when I using perf script -F ...,trace HOT 3
- Trace file recreated and new file has a 'n' added to the end of the name after running
- Adjust --minwidth options HOT 1
- Warn for low sample counts HOT 1
- How can it get some time internal flamegraph HOT 2
- Producing proper Flame Charts
- flamegraph hierarchical disorder HOT 1
- Supporting real number for samples data
- CPU flamegraphs using perf show wrong sample counts HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flamegraph.