]> xenbits.xensource.com Git - qemu-xen-unstable.git/commitdiff
s390/sclp: cache the sclp device
authorChristian Borntraeger <borntraeger@de.ibm.com>
Wed, 10 Aug 2016 10:14:19 +0000 (12:14 +0200)
committerCornelia Huck <cornelia.huck@de.ibm.com>
Mon, 5 Sep 2016 13:15:16 +0000 (15:15 +0200)
With the current code a simple sclp command takes about 13000 ns
The biggest part seems to be the resolver of the object model. By
caching the sclp device the time for an sclp command goes down to
2500ns. Talking about real life scenarios, this change doubles
the speed of the sclp console when sending single bytes outputs
to /dev/console.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
hw/s390x/sclp.c

index fca37f511e1dd48313c4484d39f07843a2f568d9..540226c6df557d42b6c8e8101b7786b39ea79a5e 100644 (file)
 
 static inline SCLPDevice *get_sclp_device(void)
 {
-    return SCLP(object_resolve_path_type("", TYPE_SCLP, NULL));
+    static SCLPDevice *sclp;
+
+    if (!sclp) {
+        sclp = SCLP(object_resolve_path_type("", TYPE_SCLP, NULL));
+    }
+    return sclp;
 }
 
 /* Provide information about the configuration, CPUs and storage */