On Mon, Mar 28, 2016 at 09:30:30PM +0800, Qiaowei Ren wrote: > This patch adds new xml element, and so we can have the option of > also having perf events enabled immediately at startup. > > Signed-off-by: Qiaowei Ren <qiaowei.ren@xxxxxxxxx> > --- > docs/schemas/domaincommon.rng | 27 +++++++ > src/conf/domain_conf.c | 111 ++++++++++++++++++++++++++ > src/conf/domain_conf.h | 10 +++ > src/qemu/qemu_driver.c | 26 ++++++ > src/qemu/qemu_process.c | 8 +- > tests/domainschemadata/domain-perf-simple.xml | 20 +++++ > 6 files changed, 200 insertions(+), 2 deletions(-) > create mode 100644 tests/domainschemadata/domain-perf-simple.xml > +static void > +virDomainPerfDefFormat(virBufferPtr buf, virDomainPerfDefPtr perf) > +{ > + size_t i; > + virBufferAddLit(buf, "<perf>\n"); We must skip ading of <perf></perf> when no perf events are enabled otherwise we break many existing test cases. eg add in bool wantPerf = false; for (i = 0; i < VIR_PERF_EVENT_LAST; i++) { if (perf->events[i]) wantPerf = true; } if (!wantPerf) return; before this line. > + virBufferAdjustIndent(buf, 2); > + > + for (i = 0; i < VIR_PERF_EVENT_LAST; i++) { > + if (perf->events[i]) > + virBufferAsprintf(buf, "<event name='%s' enabled='%s'/>\n", > + virPerfEventTypeToString(i), > + virTristateBoolTypeToString(perf->events[i])); > + } > + > + virBufferAdjustIndent(buf, -2); > + virBufferAddLit(buf, "</perf>\n"); > +} Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list