What is equivalent of tracepoints/probes Solaris sched:::on-cpu and sched:::off-cpu in Linux? - linux-kernel

What is equivalent of tracepoints/probes Solaris sched:::on-cpu and sched:::off-cpu in Linux?
https://docs.oracle.com/cd/E19253-01/817-6223/chp-sched-5/index.html

Related

Why date '+%s%N' not working on mac terminal?

I am working on bash scripts on both linux and mac.
I run this command on remote server with linux OS and it just work perfect.
CURRENT_TIME=$(date '+%s%N')
echo "$CURRENT_TIME"
However, when I run the same command on mac terminal, it shows this error:
1654778186N: value too great for base (error token is "1654778186N")
It look like mac terminal did not recognized the '%N'. What should I do to fix the issue on mac terminal?
%N is a GNU extension to the POSIX standard, as clarified in GNU's own documentation: https://www.gnu.org/software/coreutils/manual/html_node/Time-conversion-specifiers.html
The POSIX version of date, doesn't include %N: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/date.html
If I recall correctly, POSIX-certified systems (and macOS is certified) cannot add custom extensions to POSIX tools to guarantee portability across systems.

Emacs for MS Windows 10 Anniversary edition cannot find WSL bash

Emacs uses shells to execute many commands - a handy feature. Most emacs Windows users install Cygwin32 to access common bash commands. But with Windows 10 Anniversary edition bash is provided "natively" by Windows Subsystem for Linux (WSL). There should be no reason any more for Cygwin32. Unhappily, Emacs for MS Windows cannot seem to find WSL's bash. I get the following message when typing M-x shell: Searching for program: no such file or directory, bash. Is there some reason why this will not work?

Is Cmd Prompt the same as Ubuntu Terminal?

I'm sorry if this is a simple question:
I want to swap from ubuntu to windows for my web dev (personal preference). I'm used to using the terminal in ubuntu and the commands there and I was wondering whether the command prompt in windows is the same? Do the commands do the same?
If not, is there a way to get a terminal for windows the same as ubuntu?
No the Command prompt is not same as the Linux shell you may find some commands resembling to those of the shell in Linux (terminal) however to get a more Linux shell like environment you can install cygwin or GOW (Gnu on Windows). It will give you a bash.
You can find Cygwin here . and
You can find GOW here .
Its not the same, as others have answered, but since the latest version of windows 10 there is a way of running linux bash terminal in Windows.
Have a look in Bash on Windows.
It is actually running Ubuntu inside your Windows.
Windows is based on DOS but Ubuntu is based on Linux. Each of those has its own commands, with some similar commands. I personally prefer Linux commands as they are easier to understand and more simple than DOS commands. You can't use Linux commands in DOS nor the reverse.

How can I check if the Operating System is Sun Os or Unix or Solaris from by bashrc

I want to know, how can we check in the bashrc file, what operating system is it?
Use uname -a in your .bashrc file.
There is no portable way to know what Operating System is running.
Depending on the OS, uname -s will tell you what kernel you are running but not necessarily what OS.
Moreover, it cannot be SunOS or Unix or Solaris. Solaris is all of them: both a Unix compliant OS and an OS based on the SunOS kernel.
One of these might give you a precise answer depending on the Unix or Linux implementation:
cat /etc/release # SVR4, Solaris
cat /etc/redhat-release
cat /etc/*elease
cat /etc/lsb-release
oslevel -r # AIX
system_profiler -detailLevel -2 # Mac OS/X
Try this:
$cat /etc/os-release
NAME="Ubuntu"
VERSION="12.04.4 LTS, Precise Pangolin"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu precise (12.04.4 LTS)"
VERSION_ID="12.04"

How can a Perl script know its own memory footprint?

I have a long running Perl script and I'd like to let it know (and report) how much memory it is using. I'd like to have this information both on Linux and Windows and if possible on Mac OS X as well.
These Perl modules could help you:
Windows: Win32::Process::Memory
Linux(and maybe Mac OSX): Linux::Smaps
This will show you how:
http://perldoc.perl.org/Devel/Peek.html
Also, http://perldoc.perl.org/perlguts.html
and, man pages for perldebug and perldebguts.
This is a quick and dirty and most of all CPAN-free method. It works on any OS that provides a /proc file system, that is Linux and Unix derivates, including Mac OS X, and also on Cygwin under Windows:
perl -e 'print qx{ grep VmSize /proc/$$/status };'

Resources