evdev: reduce startup time
GetName() creates a new evdev device which calls tons of ioctls. But the main culprit is close() which for input devices appears to be a slow path in the kernel. This commit reduces PopulateDevices() by 50% on my laptop, but ~730 ms is still ridiculously slow for something that isn't needed right away.
This commit is contained in:
parent
8c99f60026
commit
57a005ff3e
|
@ -175,12 +175,12 @@ void PopulateDevices()
|
||||||
{
|
{
|
||||||
// Unfortunately udev gives us no way to filter out the non event device interfaces.
|
// Unfortunately udev gives us no way to filter out the non event device interfaces.
|
||||||
// So we open it and see if it works with evdev ioctls or not.
|
// So we open it and see if it works with evdev ioctls or not.
|
||||||
std::string name = GetName(devnode);
|
|
||||||
auto input = std::make_shared<evdevDevice>(devnode);
|
auto input = std::make_shared<evdevDevice>(devnode);
|
||||||
|
|
||||||
if (input->IsInteresting())
|
if (input->IsInteresting())
|
||||||
{
|
{
|
||||||
g_controller_interface.AddDevice(std::move(input));
|
g_controller_interface.AddDevice(std::move(input));
|
||||||
|
std::string name = GetName(devnode);
|
||||||
s_devnode_name_map.insert(std::pair<std::string, std::string>(devnode, name));
|
s_devnode_name_map.insert(std::pair<std::string, std::string>(devnode, name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue