Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call graph dot files missing #219

Open
choroba opened this issue May 21, 2024 · 5 comments
Open

Call graph dot files missing #219

choroba opened this issue May 21, 2024 · 5 comments
Labels

Comments

@choroba
Copy link

choroba commented May 21, 2024

When running nytprofhtml, only two dot files are created: packages-callgraph.dot and subs-callgraph.dot. All other pages contain links to additional dot files, but they don't exist.

I've found an abandoned project from 2012 where the dot files existed in the nytprof/ directory. The files claim to be produced by NYTProf 4.09.

It's interesting that changing the following condition starts creating the files - but 4.09 had the same condition as the current version.

diff --git a/bin/nytprofhtml b/bin/nytprofhtml
index 0f87ecb..861ac01 100755
--- a/bin/nytprofhtml
+++ b/bin/nytprofhtml
@@ -450,7 +450,7 @@ $reporter->set_param(
             };
 
             our %dot_file_generated;
-            if ($dot_file_generated{$dot_file}++) { # just once for line/block/sub
+            if (! $dot_file_generated{$dot_file}++) { # just once for line/block/sub
                 my $subs_in_file = $profile->subs_defined_in_file($filestr, 0);
                 # include subs defined in this file
                 # and/or called from subs defined in this file

Originally reported at PerlMonks.

@jkeenan
Copy link
Collaborator

jkeenan commented Sep 6, 2024

When running nytprofhtml, only two dot files are created: packages-callgraph.dot and subs-callgraph.dot. All other pages contain links to additional dot files, but they don't exist.

I've found an abandoned project from 2012 where the dot files existed in the nytprof/ directory. The files claim to be produced by NYTProf 4.09.

It's interesting that changing the following condition starts creating the files - but 4.09 had the same condition as the current version.

diff --git a/bin/nytprofhtml b/bin/nytprofhtml
index 0f87ecb..861ac01 100755
--- a/bin/nytprofhtml
+++ b/bin/nytprofhtml
@@ -450,7 +450,7 @@ $reporter->set_param(
             };
 
             our %dot_file_generated;
-            if ($dot_file_generated{$dot_file}++) { # just once for line/block/sub
+            if (! $dot_file_generated{$dot_file}++) { # just once for line/block/sub
                 my $subs_in_file = $profile->subs_defined_in_file($filestr, 0);
                 # include subs defined in this file
                 # and/or called from subs defined in this file

Originally reported at PerlMonks.

I have to confess that I know nothing about GraphViz or .dot files. So I can't tell whether you're reporting a real bug in Devel::NYTProf here or simply reporting a curiosity. What would I have to do to understand this?

@choroba
Copy link
Author

choroba commented Sep 6, 2024

I have to confess that I know nothing about GraphViz or .dot files. So I can't tell whether you're reporting a real bug in Devel::NYTProf here or simply reporting a curiosity. What would I have to do to understand this?

There's no need to understand GraphViz. The real question is "Should the files be built?" regardless of how they work. Having links to non-existent files in the generated HTML files seems like a real bug.

@jkeenan
Copy link
Collaborator

jkeenan commented Sep 6, 2024

I have to confess that I know nothing about GraphViz or .dot files. So I can't tell whether you're reporting a real bug in Devel::NYTProf here or simply reporting a curiosity. What would I have to do to understand this?

There's no need to understand GraphViz. The real question is "Should the files be built?" regardless of how they work. Having links to non-existent files in the generated HTML files seems like a real bug.

I attempted to reproduce the problem you reported. Please tell me whether what follows is an adequate reproduction of the problem.

I have a locally installed Perl program called get-pod-outline. It takes a single argument: a path to a POD file. I go to profile it.

$ perl -d:NYTProf /home/jkeenan/bin/perl/get-pod-outline /home/jkeenan/gitwork/perl/pod/perldelta.pod

$ nytprofhtml -o /tmp/0906-02 --open

For the moment, let's set aside the program I just reported in #221. I go to the directory specified by -o above:

$ ls *.html | wc -l
40

Of these 40 *.html files, 33 have the string \.dot; 7 do not.

$ ack -l '\.dot' *.html 
Carp-Heavy-pm-34-line.html
Carp-pm-3-line.html
Config-pm-27-line.html
constant-pm-14-line.html
Cwd-pm-13-line.html
Errno-pm-26-line.html
(eval 2)[Carp-pm-116]-5-line.html
(eval 3)[Carp-pm-171]-7-line.html
Exporter-Heavy-pm-35-line.html
Exporter-pm-9-line.html
Fcntl-pm-20-line.html
File-Basename-pm-17-line.html
File-Path-pm-16-line.html
File-Spec-pm-11-line.html
File-Spec-Unix-pm-12-line.html
File-Temp-pm-10-line.html
home-jkeenan-bin-perl-get-pod-outline-1-line.html
index.html
IO-Handle-pm-22-line.html
IO-pm-25-line.html
IO-Seekable-pm-21-line.html
List-Util-pm-31-line.html
overloading-pm-6-line.html
overload-pm-33-line.html
parent-pm-32-line.html
Scalar-Util-pm-30-line.html
SelectSaver-pm-24-line.html
strict-pm-37-line.html
Symbol-pm-23-line.html
vars-pm-18-line.html
warnings-pm-2-line.html
warnings-register-pm-15-line.html
XSLoader-pm-36-line.html

$ ack -L '\.dot' *.html 
(eval 1)[Carp-pm-21]-4-line.html
(eval 4)[Carp-pm-577]-8-line.html
(eval 5)[File-Path-pm-22]-19-line.html
(eval 6)[Errno-pm-172]-28-line.html
(eval 7)[Errno-pm-17]-29-line.html
index-subs-excl.html
subs-treemap-excl.html

Example:

$ grep -n -E '\.dot' File-Temp-pm-10-line.html
232:                <a href="home-jkeenan-perl5-perlbrew-perls-perl-5-40-0-lib-5-40-0-File-Temp-pm.dot">dot language file</a>.

However, the file which is the value for href does not actually exist.

I don't yet know why the files that do not mention .dot do so.

index.html and the 2 .dot files that actually are generated are the last to be created.

$ ls -tr | tail -n 4
packages-callgraph.dot
subs-callgraph.dot
index.html
js

Questions:

  • Does anyone actually use the non-created .dot files?
  • Were those .dot files generated in some earlier version of Devel-NYTProf?
  • If so, was the suspension of that file generation deliberate or accidental?

@jkeenan jkeenan added the bug label Sep 6, 2024
@choroba
Copy link
Author

choroba commented Sep 6, 2024

@jkeenan Yes, that's exactly the problem. I've also found and shown a way how to have the files created, but I'm unsure it's what we want and need.

@shawnlaffan
Copy link
Contributor

FWIW, the condition was first added in a4a0259

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants