Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions databases/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ fn gen_amd_cpus() {
let mut generated_file = BufWriter::new(File::create(destination).unwrap());
let mut generated_map = phf_codegen::Map::new();
// there are a few duplicate entries, so this is quick and dirty way to do duplicate detection
let mut entries: HashSet<String> = HashSet::new();
let mut entries: HashSet<&str> = HashSet::new();
let cpu_cache = IntermediateCpuCache::new();
for cpu in cpu_cache.amd_cpus {
let mut attributes_map = phf_codegen::Map::new();
// if an entry wasn't already added
if entries.insert(cpu.name.clone()) {
if entries.insert(cpu.name) {
for attr in cpu.attributes {
attributes_map.entry(format!("{:?}", attr.0), format!("{:?}", attr.1));
}
Expand Down
11 changes: 7 additions & 4 deletions parsing/src/cpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct IndexEntry {
pub struct IntermediateCpuCache<'a> {
pub intel_cpus: Vec<Cpu<&'a str>>,
intel_index: Vec<IndexEntry>,
pub amd_cpus: Vec<Cpu<String>>,
pub amd_cpus: Vec<Cpu<&'a str>>,
amd_index: Vec<IndexEntry>,
}

Expand Down Expand Up @@ -143,11 +143,14 @@ impl IntermediateCpuCache<'_> {
Err(Box::from("No close matches found"))
}
Some(idx_entry) => {
let found_cpu: &Cpu<&str>;

if input.contains("AMD") {
return Ok(self.amd_cpus[idx_entry.index].clone());
found_cpu= &self.amd_cpus[idx_entry.index];
}
else {
found_cpu = &self.intel_cpus[idx_entry.index];
}
// intel requires some work to un-zerocopy data
let found_cpu = &self.intel_cpus[idx_entry.index];
Ok(Cpu {
name: found_cpu.name.to_string(),
attributes: found_cpu
Expand Down
710 changes: 710 additions & 0 deletions parsing/src/cpu/amd/input.csv

Large diffs are not rendered by default.

Loading
Loading