Author Topic: how to check if root is rw mounted? GNU Linux, kernel >=v5  (Read 2563 times)

0 Members and 1 Guest are viewing this topic.

Online DiTBhoTopic starter

  • Super Contributor
  • ***
  • Posts: 4468
  • Country: gb
Re: how to check if root is rw mounted? GNU Linux, kernel >=v5
« Reply #25 on: January 10, 2025, 04:30:27 pm »
Code: [Select]
BYTEmark* Native Mode Benchmark ver. 2 (10/95)
Index-split by Andrew D. Balsa (11/97)
Linux/Unix* port by Uwe F. Mayer (12/96,11/97)

TEST                : Iterations/sec.  : Old Index   : New Index
                    :                  : Pentium 90* : AMD K6/233*
--------------------:------------------:-------------:------------
NUMERIC SORT        :          86.325  :       2.21  :       0.73
STRING SORT         :          7.2868  :       3.26  :       0.50
BITFIELD            :      3.2679e+07  :       5.61  :       1.17
FP EMULATION        :          7.1885  :       3.45  :       0.80
FOURIER             :          4.5823  :       0.01  :       0.00
ASSIGNMENT          :          1.4519  :       5.52  :       1.43
IDEA                :          342.73  :       5.24  :       1.56
HUFFMAN             :           13.21  :       0.37  :       0.12
NEURAL NET          :       0.0052957  :       0.01  :       0.00
LU DECOMPOSITION    :         0.12788  :       0.01  :       0.00
==========================ORIGINAL BYTEMARK RESULTS==========================
INTEGER INDEX       : 2.837
FLOATING-POINT INDEX: 0.007
Baseline (MSDOS*)   : Pentium* 90, 256 KB L2-cache, Watcom* compiler 10.0
==============================LINUX DATA BELOW===============================
CPU                 :
L2 Cache            :
OS                  : Linux 6.2.0-rc2-rb532
C compiler          : mipsel-unknown-linux-gnu-gcc
libc                :
MEMORY INDEX        : 0.946
INTEGER INDEX       : 0.570
FLOATING-POINT INDEX: 0.004
Baseline (LINUX)    : AMD K6/233*, 512 KB L2-cache, gcc 2.7.2.3, libc-5.4.38
* Trademarks are property of their respective holder.

It doesn't have much validity as a benchmark.
But it gives you an idea more or less of what type of hardware you're working with.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4842
  • Country: nz
Re: how to check if root is rw mounted? GNU Linux, kernel >=v5
« Reply #26 on: January 10, 2025, 10:16:37 pm »
BYTEmark was well known, even in the 80s, as having several benchmarks that were not very suitable because a good compiler would either do a lot of the work at compile-time (e.g. in the case of BITFIELD merging loops to do things word at a time instead of bit at a time IIRC) or noticing that results were not used at all and simply deleting them.
 

Online DiTBhoTopic starter

  • Super Contributor
  • ***
  • Posts: 4468
  • Country: gb
Re: how to check if root is rw mounted? GNU Linux, kernel >=v5
« Reply #27 on: January 11, 2025, 04:05:36 pm »
BYTEmark was well known, even in the 80s, as having several benchmarks that were not very suitable because a good compiler would either do a lot of the work at compile-time (e.g. in the case of BITFIELD merging loops to do things word at a time instead of bit at a time IIRC) or noticing that results were not used at all and simply deleting them.

I think it only makes sense comparing machines with the same toolchains, GNU/Linux { gcc, binutils }.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline macboy

  • Super Contributor
  • ***
  • Posts: 2315
  • Country: ca
Re: how to check if root is rw mounted? GNU Linux, kernel >=v5
« Reply #28 on: January 14, 2025, 06:34:41 pm »
If you want it to run even faster, don't make it a script, but a function within your shell. Then when you call it, you are not spawning a new process to execute a new shell to run the script. Your interactive shell just does the work itself.  This will be faster.
You can put a function, or many of them, into a file (e.g. "myFunctions.sh") and source the file, which essentially executes all commands in the file. In bash, you source a file with the command "."
e.g.:
.  myFunctions.sh

I do like MarkL's take on the problem, but if you are not a regex expert (a regexpert?) then it can be hard to follow. Here is what I had come up with:
Code: [Select]
function do_fs_mode_get()
{
    while read a b c d e f
    do
        if [ "$a" = "$1" ]
        then
            echo "FS: $a  mode: ${d%%,*}"
            return 0
        fi
    done < /proc/mounts
    return 1
}
« Last Edit: January 14, 2025, 06:56:13 pm by macboy »
 
The following users thanked this post: DiTBho


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf