Skip to content

Linux get context switch timing

I’m implementing some form of internal profiler. Is there a way to know when and for how long a thread is context switched out? I know windows has it w the event tracing api and I know perf logs how many context switches happens. Is there a way to do it on linux? Needing root privileges is not an issue

Why makecontext’s func only accepts integer arguments

The man page for makecontext states that the arguments after argc should be integer(int) only: …the function func is called, and passed the series of integer (int) arguments that follow argc If we look at pthread_create or clone system call, they have one void* argument which is to passed to the func, a…

Error in code for parsing arguments

i learned bash very recently, and i’m trying to read arguments for my script. So i wrote this, but i get an error (and vim has highlited in pink the last double parenthesis in the 4th line) I get the following error when i run ./test -so doc1 Can anyone help me understand what’s wrong with my scri…

AWK: variables not remembered outside actions?

I have a script that will give the percent of logins that are mine. This is done by matching all users, store to variable, then match me only (jdoe). I then use a basic operation to get the percent of logins that are mine. I get the error: ./loginPercent: line 13: eCount / totalCount: division by 0 (error tok…

subprocess.call can not send stdout to ffmpeg

My code is python. It call espeak command to generate .wav audio. Then call ffmpeg to convert wav to mp3. But this command can not send stdout from espeak to ffmpeg via subprocess.call of python: The example: What is the mistake? How can I do? Answer The pipeline you wrote is handled by the shell, and won&#82…

How to run Docker deamon on shared Linux kernel?

I have a problem starting Docker deamon. The root cause of this are missing modules in linux kernel. I don’t have possibility to change/update the kernel. Is there a workaround that would help me start Docker? If that helps: the goal I want to achieve is to set up a repository of the Docker images. I wo…

java.lang.NullPointerException and return code

I’m running some java binary from bash like: run_me.sh but inside application I get java.lang.NullPointerException, howewer return code is 0, but I need some non zero exit code to understand from bash that application failed. What is the proper way to handle such cases? Update: Here is an exxample of &#…

MSVS2015 Linux Debug starting gdbserver failed

I’m trying to debug a linux c++ application on a remote offsite server and I got this message: Any ideas? I’ve tried debugging it on an onsite linux machine (through MSVS2015 on windows) and it works fine. Answer I had a snapshot of the server prior to installing gdbserver. It worked after I insta…

Shell Mount and check directionairy existence

Just looking for some help with my mounting shell script, wondering if anyone could advice me on how to make it check for the directory at the mount point exists and is empty, or is created by the script if it does not exist Answer Your use of grep will return any mountpoint that contains the string /myfilesy…