]> Git Repo - qemu.git/commitdiff
s390/sclp: cache the sclp device
authorChristian Borntraeger <[email protected]>
Wed, 10 Aug 2016 10:14:19 +0000 (12:14 +0200)
committerCornelia Huck <[email protected]>
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 <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
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 */
This page took 0.02832 seconds and 4 git commands to generate.