Giter VIP home page Giter VIP logo

linux-ftools's Introduction

These are tools designed for working with modern linux system calls including, mincore, fallocate, fadvise, etc.

We designed these primarily to work in high performance environments to determine information about the running kernel, improve system performance, and debug performance problems.

= fincore =

{{{
fincore [options] files...

  --pages=false      Do not print pages
  --summarize        When comparing multiple files, print a summary report
  --only-cached      Only print stats for files that are actually in cache.

root@xxxxxx:/var/lib/mysql/blogindex# fincore --pages=false --summarize --only-cached * 
stats for CLUSTER_LOG_2010_05_21.MYI: file size=93840384 , total pages=22910 , cached pages=1 , cached size=4096, cached perc=0.004365 
stats for CLUSTER_LOG_2010_05_22.MYI: file size=417792 , total pages=102 , cached pages=1 , cached size=4096, cached perc=0.980392 
stats for CLUSTER_LOG_2010_05_23.MYI: file size=826368 , total pages=201 , cached pages=1 , cached size=4096, cached perc=0.497512 
stats for CLUSTER_LOG_2010_05_24.MYI: file size=192512 , total pages=47 , cached pages=1 , cached size=4096, cached perc=2.127660 
stats for CLUSTER_LOG_2010_06_03.MYI: file size=345088 , total pages=84 , cached pages=43 , cached size=176128, cached perc=51.190476 
stats for CLUSTER_LOG_2010_06_04.MYD: file size=1478552 , total pages=360 , cached pages=97 , cached size=397312, cached perc=26.944444 
stats for CLUSTER_LOG_2010_06_04.MYI: file size=205824 , total pages=50 , cached pages=29 , cached size=118784, cached perc=58.000000 
stats for COMMENT_CONTENT_2010_06_03.MYI: file size=100051968 , total pages=24426 , cached pages=10253 , cached size=41996288, cached perc=41.975764 
stats for COMMENT_CONTENT_2010_06_04.MYD: file size=716369644 , total pages=174894 , cached pages=79821 , cached size=326946816, cached perc=45.639645 
stats for COMMENT_CONTENT_2010_06_04.MYI: file size=56832000 , total pages=13875 , cached pages=5365 , cached size=21975040, cached perc=38.666667 
stats for FEED_CONTENT_2010_06_03.MYI: file size=1001518080 , total pages=244511 , cached pages=98975 , cached size=405401600, cached perc=40.478751 
stats for FEED_CONTENT_2010_06_04.MYD: file size=9206385684 , total pages=2247652 , cached pages=1018661 , cached size=4172435456, cached perc=45.321117 
stats for FEED_CONTENT_2010_06_04.MYI: file size=638005248 , total pages=155763 , cached pages=52912 , cached size=216727552, cached perc=33.969556 
stats for FEED_CONTENT_2010_06_04.frm: file size=9840 , total pages=2 , cached pages=3 , cached size=12288, cached perc=150.000000 
stats for PERMALINK_CONTENT_2010_06_03.MYI: file size=1035290624 , total pages=252756 , cached pages=108563 , cached size=444674048, cached perc=42.951700 
stats for PERMALINK_CONTENT_2010_06_04.MYD: file size=55619712720 , total pages=13579031 , cached pages=6590322 , cached size=26993958912, cached perc=48.533080 
stats for PERMALINK_CONTENT_2010_06_04.MYI: file size=659397632 , total pages=160985 , cached pages=54304 , cached size=222429184, cached perc=33.732335 
stats for PERMALINK_CONTENT_2010_06_04.frm: file size=10156 , total pages=2 , cached pages=3 , cached size=12288, cached perc=150.000000 
---
total cached size: 32847278080
}}}

= fadvise =

{{{

SYNTAX: filename mode [offset] [,length]
Where mode can be:

  POSIX_FADV_NORMAL       No further special treatment.  
  POSIX_FADV_RANDOM       Expect random page references.  
  POSIX_FADV_SEQUENTIAL   Expect sequential page references.  
  POSIX_FADV_WILLNEED     Will need these pages.  
  POSIX_FADV_DONTNEED     Dont need these pages.  
  POSIX_FADV_NOREUSE      Data will be accessed once.  

Allows an application to to tell the kernel how it expects to use a file handle,
so that the kernel can choose appropriate read-ahead and caching techniques for
access to the corresponding file. This is similar to the POSIX version of the
madvise system call, but for file access instead of memory access. The
sys_fadvise64() function is obsolete and corresponds to a broken glibc API,
sys_fadvise64_64() is the fixed version. The following are the values for the
advice parameter:

FADV_NORMAL

No special treatment.

FADV_RANDOM

Expect page references in random order.

FADV_SEQUENTIAL

Expect page references in sequential order.

FADV_WILLNEED

Expect access in the near future.

FADV_DONTNEED

Do not expect access in the near future. Subsequent access of pages in this
range will succeed, but will result either in reloading of the memory contents
from the underlying mapped file or zero-fill-in-demand pages for mappings
without an underlying file.

FADV_NOREUSE

Access data only once.
}}}

= fallocate =

{{{
SYNTAX: fallocate file length

fallocate() allows the caller to directly manipulate the allocated disk space
for the file referred to by fd for the byte range starting at offset and
continuing for len bytes.

The mode argument determines the operation to be performed on the given
range. Currently only one flag is supported for mode:

FALLOC_FL_KEEP_SIZE

This flag allocates and initializes to zero the disk space within the range
specified by offset and len. After a successful call, subsequent writes into
this range are guaranteed not to fail because of lack of disk
space. Preallocating zeroed blocks beyond the end of the file is useful for
optimizing append workloads. Preallocating blocks does not change the file size
(as reported by stat(2)) even if it is less than offset+len.

If FALLOC_FL_KEEP_SIZE flag is not specified in mode, the default behavior is
almost same as when this flag is specified. The only difference is that on
success, the file size will be changed if offset + len is greater than the file
size. This default behavior closely resembles the behavior of the
posix_fallocate(3) library function, and is intended as a method of optimally
implementing that function.

Because allocation is done in block size chunks, fallocate() may allocate a
larger range than that which was specified.
}}}

linux-ftools's People

Watchers

 avatar

linux-ftools's Issues

RELEASE update for debian build

I'd suggest to change building instructions on debian to be:
= Making Debian packages

apt-get install autoconf automake fakeroot debhelper dpkg-dev
dpkg-buildpackage -I'.git' -I'.svn' -I'.hg' -i -sd -us -uc -rfakeroot

Original issue reported on code.google.com by [email protected] on 10 May 2011 at 2:25

linux-fincore: Add support for files >2GB on 32-bit systems

What steps will reproduce the problem?
1. Run linux-fincore on a file >2GB on a 32-bit system

What is the expected output? What do you see instead?

I see the error "Could not open file: File too large"

What version of the product are you using? On what operating system?

hg latest.

Patch attached

Original issue reported on code.google.com by [email protected] on 8 Aug 2013 at 7:10

Attachments:

Issues building from source

Hello,

Is this project dead? I've been having problems building from source. I think 
these are mainly down to a few changes in build tools since this was written. I 
have included these below. I'd like to gte these working as they do look super 
useful!


What steps will reproduce the problem?

hg clone https://code.google.com/p/linux-ftools/
cd linux-ftools
./configure
make


<pre>
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh 
/home/rcampbel/src/linux-ftools/missing --run aclocal-1.11 
/home/rcampbel/src/linux-ftools/missing: line 54: aclocal-1.11: command not 
found
WARNING: `aclocal-1.11' is missing on your system.  You should only need it if
         you modified `acinclude.m4' or `configure.ac'.  You might want
         to install the `Automake' and `Perl' packages.  Grab them from
         any GNU archive site.
 cd . && /bin/sh /home/rcampbel/src/linux-ftools/missing --run automake-1.11 --gnu
/home/rcampbel/src/linux-ftools/missing: line 54: automake-1.11: command not 
found
WARNING: `automake-1.11' is missing on your system.  You should only need it if
         you modified `Makefile.am', `acinclude.m4' or `configure.ac'.
         You might want to install the `Automake' and `Perl' packages.
         Grab them from any GNU archive site.
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh 
/home/rcampbel/src/linux-ftools/missing --run autoconf
configure.ac:7: error: possibly undefined macro: AM_INIT_AUTOMAKE
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
make: *** [configure] Error 1
</pre>

autoreconf
make

<pre>
./configure: line 2202: syntax error near unexpected token `linux-ftools,'
./configure: line 2202: `AM_INIT_AUTOMAKE(linux-ftools, 1.3.0)'
</pre>

vi configure.ac

<pre>
AC_INIT([linux-ftools], [1.3.0], BUG-REPORT-ADDRESS)
AC_CONFIG_SRCDIR([linux-fincore.c])
AM_INIT_AUTOMAKE([linux-ftools], [1.3.0])
</pre>

Changed to...

<pre>
AC_INIT([linux-ftools], [1.3.0])
AC_CONFIG_SRCDIR([linux-fincore.c])
AM_INIT_AUTOMAKE
</pre>

make

<pre>
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh 
/home/rcampbel/src/linux-ftools/missing --run aclocal-1.11 
/home/rcampbel/src/linux-ftools/missing: line 54: aclocal-1.11: command not 
found
WARNING: `aclocal-1.11' is missing on your system.  You should only need it if
         you modified `acinclude.m4' or `configure.ac'.  You might want
         to install the `Automake' and `Perl' packages.  Grab them from
         any GNU archive site.
 cd . && /bin/sh /home/rcampbel/src/linux-ftools/missing --run automake-1.11 --gnu
/home/rcampbel/src/linux-ftools/missing: line 54: automake-1.11: command not 
found
WARNING: `automake-1.11' is missing on your system.  You should only need it if
         you modified `Makefile.am', `acinclude.m4' or `configure.ac'.
         You might want to install the `Automake' and `Perl' packages.
         Grab them from any GNU archive site.
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh 
/home/rcampbel/src/linux-ftools/missing --run autoconf
configure.ac:7: error: possibly undefined macro: AM_INIT_AUTOMAKE
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
make: *** [configure] Error 1
</pre>

libtoolize --force
make

<pre>
/bin/sh ./config.status --recheck
running CONFIG_SHELL=/bin/sh /bin/sh ./configure --no-create --no-recursion
./configure: line 2195: AM_INIT_AUTOMAKE: command not found
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for size_t... yes
checking for struct stat.st_blksize... yes
checking for struct stat.st_blocks... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/param.h... yes
checking for getpagesize... yes
checking for working mmap... yes
checking for getpagesize... (cached) yes
checking for memset... yes
checking for munmap... yes
checking for strtol... yes
configure: creating ./config.status
 /bin/sh ./config.status
config.status: creating Makefile
Makefile:16: *** missing separator.  Stop.
</pre>


What is the expected output? What do you see instead?

See above


What version of the product are you using? On what operating system?

CentOS 7 64 Bit in Virtualbox


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 27 May 2015 at 3:51

crash in error printing

See man 3 sprintf, first argument is a buffer, not format string.
Patch attached. Also squeeze the output (should squeeze even more), open files 
read-only, do not call mmap on empty files and directories (it will fail 
anyway), put the file name in the summary at the end so that the table stays 
aligned with long paths too.

Original issue reported on code.google.com by ygrekheretix on 7 Sep 2010 at 1:53

Attachments:

Fix gcc warnings and associated bugs

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 8 Aug 2013 at 7:05

[PATCH] make debian package buildable

Hello!
I've tryed to build linux-ftools into Debian Lenny amd64 package and met issue:
parsechangelog/debian: warning:     debian/changelog(l4): found start of entry 
where expected more change data or trailer
LINE: linux-ftools (1.0.0) unstable; urgency=low
parsechangelog/debian: warning:     debian/changelog(l4): found eof where 
expected more change data or trailer
Use of uninitialized value $v in pattern match (m//) at 
/usr/share/perl5/Dpkg/Fields.pm line 229, <STDIN> line 4.
Use of uninitialized value $v in pattern match (m//) at 
/usr/share/perl5/Dpkg/Fields.pm line 229, <STDIN> line 4.
dpkg-buildpackage: source package linux-ftools
dpkg-buildpackage: source version 1.1.0
dpkg-buildpackage: error: unable to determine source changed by

So I've fixed debian/changelog & debian/control, patch is below:
builder@builder-lenny-amd64:~/hgs/linux-ftools$ hg diff -r 336 -r 344
diff -r ab53cc4019c1 -r 272f03b0084e debian/changelog
--- a/debian/changelog  Wed Feb 09 16:03:50 2011 -0800
+++ b/debian/changelog  Tue May 10 11:35:06 2011 +0000
@@ -1,6 +1,8 @@
 linux-ftools (1.1.0) stable; urgency=high
   * Fixed a number of bugs and package is now stable

+ -- root <[email protected]>  Sun, 21 Nov 2010 04:58:07 +0000
+
 linux-ftools (1.0.0) unstable; urgency=low

   * Initial Release.
diff -r ab53cc4019c1 -r 272f03b0084e debian/control
--- a/debian/control    Wed Feb 09 16:03:50 2011 -0800
+++ b/debian/control    Tue May 10 11:35:06 2011 +0000
@@ -1,5 +1,5 @@
 Source: linux-ftools
-Section: unknown
+Section: admin
 Priority: extra
 Maintainer: Kevin Burton <[email protected]>
 Build-Depends: debhelper (>= 7), autotools-dev



Original issue reported on code.google.com by [email protected] on 10 May 2011 at 11:57

fallocate is unable to increase the size of file

What steps will reproduce the problem?
1. gcc fallocate.c 
2. ./a.out file.txt 10000000
3. ls -al

What is the expected output? What do you see instead?
upon ls -al the size should be increased by 10000000. Instead the file size 
remains same as it was before executing falloc.

What version of the product are you using? On what operating system?
linux 3.4 kernel ext4

Please provide any additional information below.
Please have look at the attached file depicting commands i have execute.Am i 
doing something wrong.

Original issue reported on code.google.com by [email protected] on 6 Aug 2012 at 10:20

Attachments:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.