-
Notifications
You must be signed in to change notification settings - Fork 792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[opentitantool] Run "nice"r sims #16913
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,9 +35,10 @@ pub struct Subprocess { | |
impl Subprocess { | ||
/// Starts a verilator [`Subprocess`] based on [`Options`]. | ||
pub fn from_options(options: Options) -> Result<Self> { | ||
let mut command = Command::new(&options.executable); | ||
let mut command = Command::new(String::from("nice")); | ||
let mut args = Vec::new(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out-of-scope nit: Looks like |
||
|
||
args.push(String::from("-5")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Peeking at There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That makes it clearer we're increasing niceness but less concise. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, now I'm worried that
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It works on my machine -5 should be equivalent to -n 5 IIRC There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll make it more verbose and readable, I just want to check that it works before I push the change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Good point. Positive nicing is less favorable to the process, so I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's misleading so I'm changing it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's a different sort of hyphen There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh! I thought it was silently ignoring I think my persistent confusion about this is evidence it should be a verbose |
||
args.push(options.executable.to_string()); | ||
if !options.rom_image.is_empty() { | ||
args.push(format!("--meminit=rom,{}", options.rom_image)); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't particularly like changing the command from the executable to 'nice', but it's the best way I know to deprioritize this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need the
String::from
? The docs for Command::new don't use it, but I didn't check the version.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think "nice" is a "slice" and new needs a String, This is something I did to make OTT build happily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave it a shot without wrapping in
String::from
and didn't have any trouble compiling. I admit I don't entirely understand theAsRef<OsStr>
type.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I guess there was some other issue that I've since fixed. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we able to use
setpriority()
or some other POSIX function instead of calling a separate program? I guessnice
will probably be available anywhere those are, though, so maybe the function is not any better. 🤔