unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Graph of elisp function calls
@ 2023-08-28 19:14 uzibalqa
  2023-08-28 21:34 ` Rodrigo Morales
  2023-08-28 23:25 ` Michael Heerdegen
  0 siblings, 2 replies; 9+ messages in thread
From: uzibalqa @ 2023-08-28 19:14 UTC (permalink / raw)
  To: uzibalqa via Users list for the GNU Emacs text editor


Is it possible to produce a graph of elisp function calls ?





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Graph of elisp function calls
  2023-08-28 19:14 Graph of elisp function calls uzibalqa
@ 2023-08-28 21:34 ` Rodrigo Morales
  2023-08-28 23:25 ` Michael Heerdegen
  1 sibling, 0 replies; 9+ messages in thread
From: Rodrigo Morales @ 2023-08-28 21:34 UTC (permalink / raw)
  To: uzibalqa; +Cc: uzibalqa via Users list for the GNU Emacs text editor

I'm not aware of a built-in function to do this, but if I had to write
code to do that. This is how I would do it:

1. Write a function Elisp that gets a tree representation of function
calls (just as `M-x profiler-report` does)
2. Output the three representation as a set of edges (just as the
command `guix graph` does)

```
$ guix graph -t references
/gnu/store/h1yiaimhmg0zf5p3czv
5xgj7ksqp527z-tesseract-ocr-5.3.0
```
```
digraph "Guix references" {
  "/gnu/store/h1yiaimhmg0zf5p3czv5xgj7ksqp527z-tesseract-ocr-5.3.0"
[label = "tesseract-ocr-5.3.0", shape = box, fontname = sans];
  "/gnu/store/h1yiaimhmg0zf5p3czv5xgj7ksqp527z-tesseract-ocr-5.3.0" ->
"/gnu/store/0hvkv5kvrk7ix29pfnbkyppbdxa7ki7n-libx11-1.8.1" [color =
magenta];
  (...some omitted lines...)
  "/gnu/store/h1yiaimhmg0zf5p3czv5xgj7ksqp527z-tesseract-ocr-5.3.0" ->
"/gnu/store/z8kgahaarjpl0b1nzpqmzyrm4bbmnxw3-libxext-1.3.4" [color =
magenta];
  "/gnu/store/h1yiaimhmg0zf5p3czv5xgj7ksqp527z-tesseract-ocr-5.3.0" ->
"/gnu/store/zkxvwia0z25409k1kmm0jqzfk9prc8fx-libpng-1.6.37" [color =
magenta];
  "/gnu/store/0hvkv5kvrk7ix29pfnbkyppbdxa7ki7n-libx11-1.8.1" [label =
"libx11-1.8.1", shape = box, fontname = sans];
  "/gnu/store/0hvkv5kvrk7ix29pfnbkyppbdxa7ki7n-libx11-1.8.1" ->
"/gnu/store/0hvkv5kvrk7ix29pfnbkyppbdxa7ki7n-libx11-1.8.1" [color =
magenta];
  (...some omitted lines...)
  "/gnu/store/0hvkv5kvrk7ix29pfnbkyppbdxa7ki7n-libx11-1.8.1" ->
"/gnu/store/yilf64y14qciml3kkj3506i3n2gmaawb-libxau-1.0.10" [color =
magenta];
  "/gnu/store/930nwsiysdvy2x5zv1sf6v7ym75z8ayk-gcc-11.3.0-lib" [label
= "gcc-11.3.0-lib", shape = box, fontname = sans];
  (...some omitted lines...)
}
```

3. Display the graph information in any way I might find convenient.
One way would be to use xdot.

```
$ guix graph -t references
/gnu/store/h1yiaimhmg0zf5p3czv5xgj7ksqp527z-tesseract-ocr-5.3.0 | xdot
-f fdp -
```

There's nothing impossible in Emacs as long as you have enough
knowledge and time.

On Mon, 28 Aug 2023 at 19:15, uzibalqa <uzibalqa@proton.me> wrote:
>
>
> Is it possible to produce a graph of elisp function calls ?
>
>
>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Graph of elisp function calls
  2023-08-28 19:14 Graph of elisp function calls uzibalqa
  2023-08-28 21:34 ` Rodrigo Morales
@ 2023-08-28 23:25 ` Michael Heerdegen
  2023-08-29  1:13   ` Heime
  1 sibling, 1 reply; 9+ messages in thread
From: Michael Heerdegen @ 2023-08-28 23:25 UTC (permalink / raw)
  To: help-gnu-emacs

uzibalqa <uzibalqa@proton.me> writes:

> Is it possible to produce a graph of elisp function calls ?

See C-h v byte-compile-generate-call-tree.  This variable allows to
display a call tree via byte compiling.  The data is then available as
value of `byte-compile-call-tree'.

Michael.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Graph of elisp function calls
  2023-08-28 23:25 ` Michael Heerdegen
@ 2023-08-29  1:13   ` Heime
  2023-08-29  1:50     ` Michael Heerdegen
  0 siblings, 1 reply; 9+ messages in thread
From: Heime @ 2023-08-29  1:13 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs






Sent with Proton Mail secure email.

------- Original Message -------
On Tuesday, August 29th, 2023 at 11:25 AM, Michael Heerdegen <michael_heerdegen@web.de> wrote:


> uzibalqa uzibalqa@proton.me writes:
> 
> > Is it possible to produce a graph of elisp function calls ?
> 
> 
> See C-h v byte-compile-generate-call-tree. This variable allows to
> display a call tree via byte compiling. The data is then available as
> value of `byte-compile-call-tree'.
> 
> Michael.

It says that functions which can be invoked interactively are excluded from the list.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Graph of elisp function calls
  2023-08-29  1:13   ` Heime
@ 2023-08-29  1:50     ` Michael Heerdegen
  2023-08-29  2:05       ` Heime
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Heerdegen @ 2023-08-29  1:50 UTC (permalink / raw)
  To: help-gnu-emacs

Heime <heimeborgia@protonmail.com> writes:

> It says that functions which can be invoked interactively are excluded
> from the list.

Excluded from "those functions which are not known to be called (that
is, to which no calls have been compiled)".  Not excluded from the call
tree, AFAIU.

Michael.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Graph of elisp function calls
  2023-08-29  1:50     ` Michael Heerdegen
@ 2023-08-29  2:05       ` Heime
  2023-08-29  2:10         ` Michael Heerdegen
  0 siblings, 1 reply; 9+ messages in thread
From: Heime @ 2023-08-29  2:05 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs






Sent with Proton Mail secure email.

------- Original Message -------
On Tuesday, August 29th, 2023 at 1:50 PM, Michael Heerdegen <michael_heerdegen@web.de> wrote:


> Heime heimeborgia@protonmail.com writes:
> 
> > It says that functions which can be invoked interactively are excluded
> > from the list.
> 
> 
> Excluded from "those functions which are not known to be called (that
> is, to which no calls have been compiled)". Not excluded from the call
> tree, AFAIU.
> 
> Michael.

I understand now.  The biggest question for me is what I need to do exactly.
Suppose I have some files in a directory, what do I need to do ?




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Graph of elisp function calls
  2023-08-29  2:05       ` Heime
@ 2023-08-29  2:10         ` Michael Heerdegen
  2023-08-29  8:13           ` Heime
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Heerdegen @ 2023-08-29  2:10 UTC (permalink / raw)
  To: help-gnu-emacs

Heime <heimeborgia@protonmail.com> writes:

> I understand now.  The biggest question for me is what I need to do exactly.
> Suppose I have some files in a directory, what do I need to do ?

What do you want - what kind of information do you need?

Michael.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Graph of elisp function calls
  2023-08-29  2:10         ` Michael Heerdegen
@ 2023-08-29  8:13           ` Heime
  2023-08-30  0:45             ` Michael Heerdegen
  0 siblings, 1 reply; 9+ messages in thread
From: Heime @ 2023-08-29  8:13 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs






Sent with Proton Mail secure email.

------- Original Message -------
On Tuesday, August 29th, 2023 at 2:10 PM, Michael Heerdegen <michael_heerdegen@web.de> wrote:


> Heime heimeborgia@protonmail.com writes:
> 
> > I understand now. The biggest question for me is what I need to do exactly.
> > Suppose I have some files in a directory, what do I need to do ?
> 
> 
> What do you want - what kind of information do you need?
> 
> Michael.

You mentioned byte compiling and the variable byte-compile-generate-call-tree

If I have a directory with elisp files in it, what would I have to do to
make to view the call tree graphically ?



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Graph of elisp function calls
  2023-08-29  8:13           ` Heime
@ 2023-08-30  0:45             ` Michael Heerdegen
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Heerdegen @ 2023-08-30  0:45 UTC (permalink / raw)
  To: help-gnu-emacs

Heime <heimeborgia@protonmail.com> writes:

> You mentioned byte compiling and the variable
> byte-compile-generate-call-tree
>
> If I have a directory with elisp files in it, what would I have to do to
> make to view the call tree graphically ?

Set `byte-compile-generate-call-tree' t.  Then I would visit the files
in dired, mark those that you want to byte-compile, and hit B
(`dired-do-byte-compile').

The result might not look very sexy and have a wrong headline
(suggesting the call tree would be for one file), but this seems to give
me a combined call tree for all files nonetheless.

AFAIR, the feature implementation still needs some love (it's a stub
with the core functionality finished), but I think it works ok.

Michael.




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-08-30  0:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-28 19:14 Graph of elisp function calls uzibalqa
2023-08-28 21:34 ` Rodrigo Morales
2023-08-28 23:25 ` Michael Heerdegen
2023-08-29  1:13   ` Heime
2023-08-29  1:50     ` Michael Heerdegen
2023-08-29  2:05       ` Heime
2023-08-29  2:10         ` Michael Heerdegen
2023-08-29  8:13           ` Heime
2023-08-30  0:45             ` Michael Heerdegen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).