9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] prof profiler changing program result
@ 2023-12-09 18:29 sirjofri
  2023-12-09 19:05 ` Steve Simon
  2023-12-13  3:28 ` Amavect
  0 siblings, 2 replies; 4+ messages in thread
From: sirjofri @ 2023-12-09 18:29 UTC (permalink / raw)
  To: 9front

Hello,

today I did an implementation of mandelbrot and learned to use prof to profile my program. I noticed that the mandelbrot result is different when linked using -p. Instead of the nice mandelbrot image I get a circle (but still with lots of details). Funnily enough, julia seems to work better.

Since my installation of 9front isn't always up to date that issue might already be fixed. I also doubt that the issue appears very often, and I didn't find any notes about issues like that when reading prof(1).

For reproduction, find this small repository: https://shithub.us/sirjofri/fractals/HEAD/info.html .

You should be able to just run `mk` to build the program, and use `mk test` to build sample images. The mkfile contains a commented out "-p" ldflag which you can use to reproduce the issue.

In general, I don't expect anyone to go this far at this stage (or at all). I'll probably take a deeper look and try to find out what's happening. Did anyone encounter other (or similar) issues when using prof and the -p flag?

sirjofri

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

* Re: [9front] prof profiler changing program result
  2023-12-09 18:29 [9front] prof profiler changing program result sirjofri
@ 2023-12-09 19:05 ` Steve Simon
  2023-12-13  3:28 ` Amavect
  1 sibling, 0 replies; 4+ messages in thread
From: Steve Simon @ 2023-12-09 19:05 UTC (permalink / raw)
  To: 9front

i have a very distant memory that there was a bug with the setting of tos (top of stack) which broke prof, this never got fixed in APE that i saw.

also there where various different attempts at tweaking the implementation of nsec() which may have effected prof.

-Steve


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

* Re: [9front] prof profiler changing program result
  2023-12-09 18:29 [9front] prof profiler changing program result sirjofri
  2023-12-09 19:05 ` Steve Simon
@ 2023-12-13  3:28 ` Amavect
  2023-12-15 10:21   ` sirjofri
  1 sibling, 1 reply; 4+ messages in thread
From: Amavect @ 2023-12-13  3:28 UTC (permalink / raw)
  To: 9front

On Sat, Dec 9, 2023 at 12:30 PM sirjofri <sirjofri+ml-9front@sirjofri.de> wrote:
>today I did an implementation of mandelbrot and learned to use prof to profile my program.
>I noticed that the mandelbrot result is different when linked using -p.
>Instead of the nice mandelbrot image I get a circle (but still with lots of details).
>Funnily enough, julia seems to work better.
You have uninitialized variables.
I guess kencc doesn't warn if you don't fully initialize a struct.
Acid showed me that SetParams params was initialized differently by
the time it reaches generate().
The .julia field gets an uninitialized value of 0 without -p, and an
uninitialized value of 1 with -p.
After setting a zero struct initializer {0}, the mandelbrot generates correctly.
After setting a struct initializer {1}, the mandelbrot generates
incorrectly in the same way.

Thanks,
Amavect

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

* Re: [9front] prof profiler changing program result
  2023-12-13  3:28 ` Amavect
@ 2023-12-15 10:21   ` sirjofri
  0 siblings, 0 replies; 4+ messages in thread
From: sirjofri @ 2023-12-15 10:21 UTC (permalink / raw)
  To: 9front

13.12.2023 04:30:51 Amavect <amavect@gmail.com>:

> On Sat, Dec 9, 2023 at 12:30 PM sirjofri <sirjofri+ml-9front@sirjofri.de> wrote:
>> today I did an implementation of mandelbrot and learned to use prof to profile my program.
>> I noticed that the mandelbrot result is different when linked using -p.
>> Instead of the nice mandelbrot image I get a circle (but still with lots of details).
>> Funnily enough, julia seems to work better.
> You have uninitialized variables.
> I guess kencc doesn't warn if you don't fully initialize a struct.
> Acid showed me that SetParams params was initialized differently by
> the time it reaches generate().
> The .julia field gets an uninitialized value of 0 without -p, and an
> uninitialized value of 1 with -p.
> After setting a zero struct initializer {0}, the mandelbrot generates correctly.
> After setting a struct initializer {1}, the mandelbrot generates
> incorrectly in the same way.

Good catch, I didn't think about that.

I fixed my program now and it works, thank you for pointing it out.

sirjofri


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

end of thread, other threads:[~2023-12-15 10:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-09 18:29 [9front] prof profiler changing program result sirjofri
2023-12-09 19:05 ` Steve Simon
2023-12-13  3:28 ` Amavect
2023-12-15 10:21   ` sirjofri

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 NNTP newsgroup(s).