Hi Daniel,

> > +    SocketAddress saddr = {
> > +        .type = SOCKET_ADDRESS_TYPE_UNIX,
> > +        .u.q_unix.path = socket_path
> > +    };
> > +    QIOChannelSocket *sioc = qio_channel_socket_new();
> > +    Error *local_err = NULL;
> > +
> > +    int r;
> > +
> > +    qio_channel_set_name(QIO_CHANNEL(sioc), "vmsr-helper");
> > +    qio_channel_socket_connect_sync(sioc,
> > +                                    &saddr,
> > +                                    &local_err);
> > +    g_free(socket_path);
> > +    if (local_err) {
> > +        goto out_close;
> > +    }
>
> In the previous posting I suggested that connectiong to the
> helper again & again for every individual MSR read is a
> high overhead. Connect once, and then just keep the socket
> open forever.
>

Indeed, this would be way more efficient. 

Does that means that I should create the socket during the 
initialisation of the main loop (kvm_msr_energy_thread_init) and keep 
track of the context variable and then just give the QIOChannelSocket 
pointer has a parameter to the vmsr_read_msr() function to send the 
data?

Regards,
Anthony


Reply via email to