Re: [PATCH 3/3] Test on solib load and unload

Gary Benson
2013-09-27T14:09:53Z

Hi Yao,

Yao Qi wrote:

> This patch is to add a test case to on the performance of GDB
> handling load and unload of shared library.

Thanks for writing this. I ran it on the setup I had for testing the
probes code, and it does pick up on the differences between probes
and non-probes.

> +void
> +do_test (int number)
> +{
> + void **handles;
> + char libname[40];
> + int i;
> +
> + handles = malloc (sizeof (void *) * number);
> +
> + for (i = 0; i < number; i++)
> + {
> + sprintf (libname, "solib-lib%d", i);
> + handles[i] = dlopen (libname, RTLD_LAZY);
> + if (handles[i] == NULL)
> + {
> + printf ("ERROR on dlopen %s\n", libname);
> + return;
> + }
> + }
> +
> + /* Unload shared libraries in different orders. */
> +#ifndef SOLIB_DLCLOSE_REVERSED_ORDER
> + for (i = 0; i < number; i++)
> +#else
> + for (i = number - 1; i >= 0; i--)
> +#endif
> + dlclose (handles[i]);
> +
> + free (handles);
> +}

I'm not sure how important this is, but this test is profiling both
load and unload. It's theoretically possible that a change could be
made that improved one phase while degrading the other, so it would
be nice to see separate timings if that's not too hard to implement.
For the avoidance of doubt I don't consider the absence of separate
timings a blocker.

Thanks,
Gary

--