Coder Social home page Coder Social logo

aparato's People

Contributors

grtcdr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

aparato's Issues

Reimplement `Fetch`

In version 5.0, the Linux implementation of Fetch was removed so it could be reworked. It will now be reimplemented but with performance in mind.

What must be done different?

  • Fetch::fetch_by_class() in previous versions would create a PCIDevice out of every PCI device it could find, then and only then, does it remove the irrelevant PCI devices, and this costs time and is so inefficient it literally blows my mind why I decided to implement it the way I did.

Nice-To-Haves

  • A new method, something along the lines of Fetch::fetch_by_subclass(name) where name is of type String. This method should return only the PCI devices whose subclass (click any click to see subclasses) is equal to what was provided to the method. It is unmaintainable for me to provide an enum with ready-to-use subclasses, because there's well over 50 of these, and they're always changing.

test failures on ppc64le and s390x

When building aparato on ppc64le and s390x the tests fail.

ppc64le:

    Running `/builddir/build/BUILD/aparato-6.0.0/target/release/deps/aparato-5a9ba48135f0c5e6`
running 10 tests
test linux::tests::test_address ... ok
test linux::tests::test_class_id ... FAILED
test linux::tests::test_device_id ... FAILED
test linux::tests::test_path ... ok
test linux::tests::test_class_name ... FAILED
test linux::tests::test_revision ... FAILED
test linux::tests::test_subsystem_device_id ... FAILED
test linux::tests::test_subsystem_vendor_id ... FAILED
test linux::tests::test_vendor_id ... FAILED
test linux::tests::test_numa_node ... ok
failures:
---- linux::tests::test_class_id stdout ----
thread 'linux::tests::test_class_id' panicked at 'assertion failed: `(left != right)`
  left: `[]`,
 right: `[]`', src/linux/mod.rs:556:9
---- linux::tests::test_device_id stdout ----
thread 'linux::tests::test_device_id' panicked at 'assertion failed: `(left != right)`
  left: `[]`,
 right: `[]`', src/linux/mod.rs:568:9
---- linux::tests::test_class_name stdout ----
thread 'linux::tests::test_class_name' panicked at 'assertion failed: `(left != right)`
  left: `""`,
 right: `""`', src/linux/mod.rs:598:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---- linux::tests::test_revision stdout ----
thread 'linux::tests::test_revision' panicked at 'assertion failed: `(left != right)`
  left: `[]`,
 right: `[]`', src/linux/mod.rs:580:9
---- linux::tests::test_subsystem_device_id stdout ----
thread 'linux::tests::test_subsystem_device_id' panicked at 'assertion failed: `(left != right)`
  left: `[]`,
 right: `[]`', src/linux/mod.rs:592:9
---- linux::tests::test_subsystem_vendor_id stdout ----
thread 'linux::tests::test_subsystem_vendor_id' panicked at 'assertion failed: `(left != right)`
  left: `[]`,
 right: `[]`', src/linux/mod.rs:586:9
---- linux::tests::test_vendor_id stdout ----
thread 'linux::tests::test_vendor_id' panicked at 'assertion failed: `(left != right)`
  left: `[]`,
 right: `[]`', src/linux/mod.rs:562:9
failures:
    linux::tests::test_class_id
    linux::tests::test_class_name
    linux::tests::test_device_id
    linux::tests::test_revision
    linux::tests::test_subsystem_device_id
    linux::tests::test_subsystem_vendor_id
    linux::tests::test_vendor_id
test result: FAILED. 3 passed; 7 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

s390x:

     Running `/builddir/build/BUILD/aparato-6.0.0/target/release/deps/aparato-dbbd6af19f4502c3`
running 10 tests
test linux::tests::test_address ... ok
test linux::tests::test_class_name ... FAILED
test linux::tests::test_device_id ... FAILED
test linux::tests::test_numa_node ... ok
test linux::tests::test_path ... ok
test linux::tests::test_subsystem_device_id ... FAILED
test linux::tests::test_revision ... FAILED
test linux::tests::test_subsystem_vendor_id ... FAILED
test linux::tests::test_vendor_id ... FAILED
test linux::tests::test_class_id ... FAILED
failures:
---- linux::tests::test_class_name stdout ----
thread 'linux::tests::test_class_name' panicked at 'assertion failed: `(left != right)`
  left: `""`,
 right: `""`', src/linux/mod.rs:598:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---- linux::tests::test_device_id stdout ----
thread 'linux::tests::test_device_id' panicked at 'assertion failed: `(left != right)`
  left: `[]`,
 right: `[]`', src/linux/mod.rs:568:9
---- linux::tests::test_subsystem_device_id stdout ----
thread 'linux::tests::test_subsystem_device_id' panicked at 'assertion failed: `(left != right)`
  left: `[]`,
 right: `[]`', src/linux/mod.rs:592:9
---- linux::tests::test_revision stdout ----
thread 'linux::tests::test_revision' panicked at 'assertion failed: `(left != right)`
  left: `[]`,
 right: `[]`', src/linux/mod.rs:580:9
---- linux::tests::test_subsystem_vendor_id stdout ----
thread 'linux::tests::test_subsystem_vendor_id' panicked at 'assertion failed: `(left != right)`
  left: `[]`,
 right: `[]`', src/linux/mod.rs:586:9
---- linux::tests::test_vendor_id stdout ----
thread 'linux::tests::test_vendor_id' panicked at 'assertion failed: `(left != right)`
  left: `[]`,
 right: `[]`', src/linux/mod.rs:562:9
---- linux::tests::test_class_id stdout ----
thread 'linux::tests::test_class_id' panicked at 'assertion failed: `(left != right)`
  left: `[]`,
 right: `[]`', src/linux/mod.rs:556:9
failures:
    linux::tests::test_class_id
    linux::tests::test_class_name
    linux::tests::test_device_id
    linux::tests::test_revision
    linux::tests::test_subsystem_device_id
    linux::tests::test_subsystem_vendor_id
    linux::tests::test_vendor_id
test result: FAILED. 3 passed; 7 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

You can find the full logs at https://koji.fedoraproject.org/koji/taskinfo?taskID=72224758 and https://koji.fedoraproject.org/koji/taskinfo?taskID=72224759 (look at build.log).

PCIDevice::fetch_by_class() returning nothing

Description

fetch_by_class() appears to be broken (returns nothing), passing any variant of DeviceClass to the function results in the same behavior.

To reproduce:

let thing: Vec<PCIDevice> = PCIDevice::fetch_by_class(DeviceClass::NetworkController);
println!("{:?}", thing);

37672be fixes this.

Use integers rather than `String` for `PCIDevice` `x_id` fields.

What?

The following fields could be represented as integers:

class_id: String -> class_id: usize
vendor_id: String -> vendor_id: usize
device_id: String -> device_id: usize
// Spoilers ahead!
subsystem_vendor_id: String -> subsystem_vendor_id: usize
subsystem_device_id: String -> subsystem_device_id: usize

Why?

Using String for fields that may as well be integers, is very expensive.

PCI ID wrong parse

Hi,

Thanks for for your crate. I've been testing it with mixed results as in two systems the hw listed seems ok but the other one the results are wrong. I looked at you code and found the error on the set_*_name() functions for device and subsystem.

The parser generate not valid results due to the following bugs in your code when parsing pci id file:

  • Device name: Vendor is not considered (first step in decoding should be to locate the vendor section in the file) & the parsing do not discard '\t\t' lines that describe subystems.
  • Subsystem name: Vendor ins not considered as in the device name.

I think these bugs are easy to fix. I can do a PR but I don't know if you are working on that as I see that you have a open PR to address accuracy.

Improve pci.ids parsing

Addressing slowness

aparato runs really, really slooow when fetching PCI devices in bulk, through fetch(), fetch_by_class() or fetch_gpus()
If you're instantiating one PCI device, the performance is acceptable (around 3-5ms), but when you're fetching multiple devices, that's when you notice how slow it can get (around 80-90ms).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.