On Wed, Dec 11, 2013 at 10:00 PM, Ben Pfaff <b...@nicira.com> wrote: > On Tue, Dec 10, 2013 at 02:49:29PM +0100, Helmut Schaa wrote: >> Use a global array that gets initialized by constructor functions >> per coverage definition. >> >> Signed-off-by: Helmut Schaa <helmut.sc...@googlemail.com> >> --- >> >> The realloc is not the nicest thing to do but looks reasonable as initial >> approach. Using a list would cause more intrusive changes to the coverage >> implementation. > > Could you refactor the constructor code as a call to a helper > function, please? (That will allow you to make the coverage_counters > definitions static within coverage.c, I think.)
Agreed. > I suggest using x2nrealloc instead of xrealloc for this. Hmm, good point. I think its a trade off between initialization performance vs. wasting some memory over the lifetime of all OVS processes. Right now there are ~100 coverage events which translates to an array size of 400 bytes. So, when using x2nrealloc we will end up with 512 bytes allocated and 112 of them unused. I mean usually the OS will reserve some more bytes for us anyway :D Since the number of events is known a priori it might make sense to preallocate a given number anyway. I'll see with what I can come up with. Helmut _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev