pax_global_header00006660000000000000000000000064143013606700014512gustar00rootroot0000000000000052 comment=d52efa35e1d6d02495434e9447ee04c21b2e1010 ioping-1.3/000077500000000000000000000000001430136067000126425ustar00rootroot00000000000000ioping-1.3/.gitignore000066400000000000000000000000141430136067000146250ustar00rootroot00000000000000*.o /ioping ioping-1.3/.travis.yml000066400000000000000000000000661430136067000147550ustar00rootroot00000000000000os: - linux - osx script: - make - make test ioping-1.3/LICENSE000066400000000000000000001045131430136067000136530ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ioping-1.3/Makefile000066400000000000000000000053011430136067000143010ustar00rootroot00000000000000prefix=/usr/local PREFIX=$(prefix) BINDIR=$(PREFIX)/bin MAN1DIR=$(PREFIX)/share/man/man1 SRCS=ioping.c BINARY=ioping MANS=ioping.1 MANS_F=$(MANS:.1=.txt) $(MANS:.1=.pdf) DOCS=README.md LICENSE changelog SPEC=ioping.spec PACKAGE=ioping GIT_VER:=$(shell test -d .git && git describe --tags --match 'v[0-9]*' \ --abbrev=0 | sed 's/v//') SRC_VER:=$(shell sed -ne 's/\# define VERSION \"\(.*\)\"/\1/p' ioping.c) EXTRA_VERSION:=$(shell test -d .git && git describe --tags --match 'v[0-9]*' \ --dirty=+ | sed 's/^v[^-]*//;s/-/./g') VERSION:=$(SRC_VER)$(EXTRA_VERSION) DISTDIR=$(PACKAGE)-$(VERSION) DISTFILES=$(SRCS) $(MANS) $(DOCS) $(SPEC) Makefile PACKFILES=$(BINARY) $(MANS) $(MANS_F) $(DOCS) CFLAGS ?= -g -O2 -funroll-loops -ftree-vectorize CFLAGS += -std=gnu99 -Wall -Wextra -pedantic CPPFLAGS = -DEXTRA_VERSION=\"${EXTRA_VERSION}\" ifneq (,$(STATIC)) CFLAGS += -static endif LIBS = -lm -lrt MINGW = x86_64-w64-mingw32- MINGW_CFLAGS = -specs=ucrt-spec -Wno-format MINGW_LIBS = -lm CC = $(CROSS_COMPILE)gcc STRIP = $(CROSS_COMPILE)strip TARGET = $(shell ${CC} -dumpmachine) ifneq (,$(findstring -apple-,${TARGET})) LIBS=-lm endif ifneq (,$(findstring -mingw,${TARGET})) BINARY := $(BINARY:=.exe) CFLAGS += ${MINGW_CFLAGS} LIBS := ${MINGW_LIBS} ${BINARY}: ucrt-spec endif all: checkver $(BINARY) static: $(MAKE) STATIC=1 version: checkver @echo ${VERSION} checkver: @if test -n "$(GIT_VER)" -a "$(GIT_VER)" != "$(SRC_VER)"; then \ echo "ERROR: Version mismatch between git and source"; \ echo git: $(GIT_VER), src: $(SRC_VER); \ exit 1; \ fi clean: $(RM) -f $(BINARY) $(MANS_F) ioping.tmp strip: $(BINARY) $(STRIP) $^ test: $(BINARY) ./$(BINARY) -i 10ms -c 3 -s 512 -S 16k ${PWD} ./$(BINARY) -w 10ms -R -k -S 1m . ./$(BINARY) -w 10ms -RL ioping.tmp rm ioping.tmp install: $(BINARY) $(MANS) mkdir -p $(DESTDIR)$(BINDIR) install -m 0755 $(BINARY) $(DESTDIR)$(BINDIR) mkdir -p $(DESTDIR)$(MAN1DIR) install -m 644 $(MANS) $(DESTDIR)$(MAN1DIR) %.ps: %.1 man -t ./$< > $@ %.pdf: %.ps ps2pdf $< $@ %.txt: %.1 MANWIDTH=80 man ./$< | col -b > $@ $(BINARY): $(SRCS) $(CC) -o $@ $(SRCS) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(LIBS) ucrt-spec: ${MINGW}gcc -dumpspecs | sed 's/-lmsvcrt/-lucrt/' > $@ mingw: $(MAKE) CROSS_COMPILE=${MINGW} dist: checkver $(DISTFILES) tar -cz --transform='s,^,$(DISTDIR)/,S' $^ -f $(DISTDIR).tar.gz binary-tgz: checkver $(PACKFILES) ${STRIP} ${BINARY} tar -cz --transform='s,^,$(DISTDIR)/,S' -f ${PACKAGE}-${VERSION}-${TARGET}.tgz $^ binary-zip: checkver $(PACKFILES) ${STRIP} ${BINARY} ln -s . $(DISTDIR) zip ${PACKAGE}-${VERSION}-${TARGET}.zip $(addprefix $(DISTDIR)/,$^) rm $(DISTDIR) .PHONY: all version checkver clean strip test install dist binary-tgz binary-zip ioping-1.3/README.md000066400000000000000000000042341430136067000141240ustar00rootroot00000000000000ioping ====== A tool to monitor I/O latency in real time. It shows disk latency in the same way as ping shows network latency. Homepage: https://github.com/koct9i/ioping/ (migrated from http://code.google.com/p/ioping/) Please send your patches, issues and questions to https://github.com/koct9i/ioping/issues/ Supported OS ------------ * GNU/Linux * GNU/HURD * Windows * OS X * FreeBSD * DragonFlyBSD * OpenBSD Packages -------- * Debian: https://packages.debian.org/unstable/main/ioping * Ubuntu: https://launchpad.net/ubuntu/+source/ioping * Fedora: https://apps.fedoraproject.org/packages/ioping * ArchLinux: https://www.archlinux.org/packages/community/x86_64/ioping * AltLinux: http://www.sisyphus.ru/en/srpm/Sisyphus/ioping * Gentoo: https://packages.gentoo.org/package/app-benchmarks/ioping * Nix: https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/system/ioping/default.nix * FreeBSD: http://www.freshports.org/sysutils/ioping * OS X: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/ioping.rb Examples -------- Show disk I/O latency using the default values and the current directory, until interrupted ``` $ ioping . 4096 bytes from . (ext4 /dev/sda3): request=1 time=0.2 ms 4096 bytes from . (ext4 /dev/sda3): request=2 time=0.2 ms 4096 bytes from . (ext4 /dev/sda3): request=3 time=0.3 ms 4096 bytes from . (ext4 /dev/sda3): request=4 time=12.7 ms 4096 bytes from . (ext4 /dev/sda3): request=5 time=0.3 ms ^C --- . (ext4 /dev/sda3) ioping statistics --- 5 requests completed in 4794.0 ms, 364 iops, 1.4 MiB/s min/avg/max/mdev = 0.2/2.8/12.7/5.0 ms ``` Measure disk seek rate (iops, avg) ``` $ ioping -R /dev/sda --- /dev/sda (device 465.8 GiB) ioping statistics --- 186 requests completed in 3004.6 ms, 62 iops, 0.2 MiB/s min/avg/max/mdev = 6.4/16.0/26.8/4.7 ms ``` Measure disk sequential speed (MiB/s) ``` $ ioping -RL /dev/sda --- /dev/sda (device 465.8 GiB) ioping statistics --- 837 requests completed in 3004.1 ms, 292 iops, 72.9 MiB/s min/avg/max/mdev = 2.0/3.4/28.9/2.0 ms ``` Authors ------- * Konstantin Khlebnikov * Kir Kolyshkin Licensed under GPLv3 (or later) ioping-1.3/changelog000066400000000000000000000306261430136067000145230ustar00rootroot00000000000000 v1.3 / 2022-08-24 ================== * Workaround for glibc 2.36 sys/mount.h * ioping: add RWF_HIPRI * ioping: add "make static" * ioping: print notice "slow"/"fast" when twice slower/faster than average * ioping: cleanup timing notice * ioping: fix mingw build * ioping: add option -burst * ioping: include stdbool * ioping: restore CPPFLAGS in makefile * ioping: use 64-bit printf format * ioping: switch mingw build to 64-bit and ucrt * ioping: retrive device size and name for windows * ioping: use F_FULLFSYNC for OSX * ioping: move fdatasync after write out of make_request() * ioping: implement O_SYNC for windows by FILE_FLAG_WRITE_THROUGH * ioping: fallback from non-cached to direct only for reads * ioping: rename global target fd variable * ioping: add option -e, -entropy for deterministic randomization * ioping: add support nowait I/O (RWF_NOWAIT) * ioping: print help and version into stdout * ioping: add option -I|-time to print current time * ioping: describe json format in manpage * ioping: add human-readable localtime into json output v1.2 / 2020-02-02 ================== * makefile: merge compiling and linking * ioping: add -r, -rate-limit * ioping: reformat usage * Merge pull request #42 from kohju/patch-Solaris * Support for Solaris. * ioping: option -J|-json for printing JSON * ioping: add option -a|-warmup * ioping: add long options * ioping: print filesystem size for file or directory target * Merge pull request #39 from justinpitts/patch-1 * Fix grammar mistake. v1.1 / 2018-09-11 ================== * ioping: release 1.1 * ioping.1: raw statisitics in nanoseconds * Merge pull request #37 from standby24x7/fix-man * Fix a typo in ioping.1 * Merge pull request #36 from lewellyn/solaris * Correct Solaris predefined macro * ioping.1: add more references * Merge pull request #32 from kolyshkin/makefile * Makefile: only use vN tags for EXTRA_VERSION * ioping.c: set VERSION to 1.0 * Makefile: make sure git tag == src ver * Makefile: make all phony targets as such * Makefile: move -D to CPPFLAGS * ioping(1): fix aio description v1.0 / 2016-12-11 ================= * ioping: update changelog * ioping: cleanup statistics * ioping: allow fractional values in arguments * ioping: print total requests count in raw statistics * ioping: ignore first and classify other requests * ioping: add read-write mode * ioping: add option for speed limit * ioping: print total time, speed and count of requests * ioping: add mkostemp * ioping: add O_SYNC and O_DSYNC modes * ioping: call fadvise(RANDOM) for random I/O * ioping: remove fdatasync test before oprations * Merge pull request #29 from vapier/master * Makefile: do not strip while installing * Makefile: make it easier to override default optimization settings * Makefile: respect CPPFLAGS when compiling * ignore generated files * ioping: include sys/sysmacros.h for makedev * ioping: use xorshift128+ for randomization * Makefile: fix mac detection * Makefile: no -lrt for mac * ioping: no clock_gettime for mac * travis-ci: enable osx * ioping: link mingw without -lrt * ioping: link with -lrt * travis-ci: add .travis.yml * Makefile: add test target * ioping: switch to nanosecond precision * Makefile: rename README to README.md * Merge branch 'patch-1' of https://github.com/davidak/ioping * README.md: update formatting * Merge pull request #27 from jgrizou/master * Rename README to README.md * Update README * add link to Nix expression * ioping: update changelog * ioping: use long long for count of requests * ioping: add option -t for detecting cache hits * ioping: use cached direct I/O by default if non-cached isn't supported * ioping: add windows "overlapped" aio * ioping: declare windows have direct I/O * ioping: open files with CreateFile on windows * ioping: get more randomness on windows * ioping: do not override custom interval and deadline by -R * Makefile: add top directory into binary archives * ioping: keep VERSION right in ioping.c * ioping: update help and manpage * ioping: update README * ioping: fix several integer overflows * ioping: handle big requests on linux * ioping: always respect explicitly set size * ioping: print amount of data written/read * ioping: print io run-time instead of real-time * ioping: expand all symlinks in device path v0.9 / 2014-10-06 ================= * ioping.1: update manpage * ioping: rename global count to stop_at_request * ioping: fix final bps overflow * ioping: update changelog and dates * ioping: include LICENSE into tarball * ioping: fix create_temp for windows * ioping: fix O_TMPFILE * Makefile: add strip target * ioping: randomize data to avoid compression in ssd * ioping: fix support of character devices * ioping: print 'to' instead of 'from' for write requests * ioping: fix mingw port compilation * ioping: print at least three decimal digits * ioping: add option for keeping/reusing working file * ioping: add support for O_TMPFILE * ioping: make block device support optional * ioping: add copy of gpl-v3 * ioping: port to solaris os * ioping: switch stdout into line-buffered mode * ioping: fix warning messages v0.8 / 2013-12-30 ================= * ioping: add links to related tools and projects * ioping: add hints for units into manpage * iopint: unhardcode units for printing device size * ioping: warn about unreliable results on poor platforms * ioping: update dates and changelog * ioping: use snprintf instead of sprintf * ioping: use c99 macro from inttypes.h for printing 64-bit values * ioping: move features macro into source code * ioping: ignore undefined version * ioping: pick fix_manpage_hyphen.patch from debian * ioping: add link to homepage into README * ioping: use IEEE 1541-2002 units for printing * ioping: fix OpenBSD port * ioping: OpenBSD port * ioping: detect fdatasync availability v0.7 / 2013-02-02 ================= * ioping: automatically choose best units for human-readable output * ioping: update makefile * ioping: rework binary packs * ioping: add documentation * ioping: put aio errors into errno * ioping: ioping.pdf target * ioping.1: use common groff macroses * ioping: less weird period-deadline * ioping: DragonFlyBSD port * ioping: binary packs * ioping: mingw windows port * ioping: batch mode * ioping: use nanosleep to sleep * ioping: fix -c limit * ioping: don't use long long format * ioping: use gnu99 gcc standard * ioping: rework version control * ioping: fix typos * ioping: write-test * ioping: time period for statistics * ioping: extended raw statistics * ioping: fix 32-bit aio * ioping: add linux aio support * ioping: avoid zero usleep v0.6 / 2011-08-01 ================= * release v0.6 * ioping: enable direct for freebsd * ioping: fixup freebsd port * ioping: fix misprint * ioping.1: document tera suffixes * ioping: fix help for -L option * ioping.1: add authors * ioping.1: add homepage * ioping: Use consistent names for direct I/O and cached I/O * ioping.1: Add -v to man page SYNOPSYS and help message * ioping.1: fix description of -L option * ioping: port to Debian GNU/Hurd * ioping: port to Debian GNU/kFreeBSD * ioping: untwist cached-direct modes * ioping: fix 32-bit wsize overflow * ioping: document defaults in man and help * ioping: show target info in final statictics * ioping: use git-describe to retrieve version * ioping: fix help for -R * ioping: move 64m temp working set size to rate test * ioping: add builtin version and -v * bsd,apl: concentrate magic on top * ioping.1: describe sector-size suffix * ioping.1: describe suffixes for -p and -c * Fix a typo in a define * displaying stats: add comma, obey 80 column width * ioping, ioping.1: better description of -R * ioping, ioping.1: -h is an exclusive option * ioping.1: assorted improvements v0.5 / 2011-06-16 ================= * release v0.5 * rate test, iops * show block device size * include sys/disk.h for freebsd * don't use getopt() GNU extension * use F_NOCACHE not only for macos * inclide sys/uio.h at macos * add parse_device() for freebsd and macos * use macos fcntl F_NOCACHE * more disk size ioctls * enable direct and cached if there no posix_fadvise() * add get_block_size() * stubs for posix_memalign() and posix_fadvice() * use posix_memalign() instead of memalign() * show final statistics in quiet mode if period not specified * show io speed v0.4 / 2011-06-02 ================= * bump version * workaround gcc bug, or this is a feature? * ioping.spec: raise version to 0.3 * make dist: do not rebuild dist if non needed * Fix i386 RPM build on an x86_64 * Since 'make dist' generates tar.gz this is what we should use. * oops * use stat() instead of lstat() * ioping -h should exit with 0 * man: describe non-zero exit codes * error codes: 0: success 1: argument error 2: preparation error 3: runtime error * use errx for fcntl error messages * fix segfault in parse_device() * Added support for older kernels lacking /proc/self/mountinfo. Try to use info from /proc/self/mounts if there is no mountinfo. * Fix misleading error message * use full working set range by default * Use random operations by defult, add -L option for sequential. * fix interrupt * fix tabs in spec * Makefile: add 'dist' and similar targets * Add spec file (RPM packaging) * Add ioping(1) man page * fixup * This tries to address two issues: * 'ioping -w' was going over the time limit specified. For example, 'ioping -w 7 -i 2' was taking 8 seconds to run, not 7 or less. Fix it by moving the check to before usleep(), and taking the interval (ie usleep argument) into account. * * ioping -c|-w: do not oversleep * ioping: use system message for ENOMEM * ioping: don't print 'unknown option' twice, show usage * Makefile: add DESTDIR support Needed mostly for distro vendors (.spec writers etc.) * ioping -h: fit output to 80 col width * randomization, fixing usage * working set size, cleanups, fixes, etc... * initial * Initial directory structure. v1.0 / 2016-12-11 ================= * ioping: update changelog * ioping: cleanup statistics * ioping: allow fractional values in arguments * ioping: print total requests count in raw statistics * ioping: ignore first and classify other requests * ioping: add read-write mode * ioping: add option for speed limit * ioping: print total time, speed and count of requests * ioping: add mkostemp * ioping: add O_SYNC and O_DSYNC modes * ioping: call fadvise(RANDOM) for random I/O * ioping: remove fdatasync test before oprations * Merge pull request #29 from vapier/master * Makefile: do not strip while installing * Makefile: make it easier to override default optimization settings * Makefile: respect CPPFLAGS when compiling * ignore generated files * ioping: include sys/sysmacros.h for makedev * ioping: use xorshift128+ for randomization * Makefile: fix mac detection * Makefile: no -lrt for mac * ioping: no clock_gettime for mac * travis-ci: enable osx * ioping: link mingw without -lrt * ioping: link with -lrt * travis-ci: add .travis.yml * Makefile: add test target * ioping: switch to nanosecond precision * Makefile: rename README to README.md * Merge branch 'patch-1' of https://github.com/davidak/ioping * README.md: update formatting * Merge pull request #27 from jgrizou/master * Rename README to README.md * Update README * add link to Nix expression * ioping: update changelog * ioping: use long long for count of requests * ioping: add option -t for detecting cache hits * ioping: use cached direct I/O by default if non-cached isn't supported * ioping: add windows "overlapped" aio * ioping: declare windows have direct I/O * ioping: open files with CreateFile on windows * ioping: get more randomness on windows * ioping: do not override custom interval and deadline by -R * Makefile: add top directory into binary archives * ioping: keep VERSION right in ioping.c * ioping: update help and manpage * ioping: update README * ioping: fix several integer overflows * ioping: handle big requests on linux * ioping: always respect explicitly set size * ioping: print amount of data written/read * ioping: print io run-time instead of real-time * ioping: expand all symlinks in device path ioping-1.3/ioping.1000066400000000000000000000220601430136067000142110ustar00rootroot00000000000000.TH IOPING "1" "Oct 2014" "" "User Commands" .SH NAME ioping \- simple disk I/O latency monitoring tool .SH SYNOPSYS .SY ioping .OP \-ABCDJLNRWGYykq .OP \-a count .OP \-b count .OP \-c count .OP \-e seed .OP \-i interval .OP \-l speed .OP \-r rate .OP \-t time .OP \-T time .OP \-s size .OP \-S wsize .OP \-o offset .OP \-w deadline .OP \-p period .OP \-P period .OP \-I [format] .IR directory | file | device .br .SY ioping .B -h | .B -v .br .SH DESCRIPTION This tool generates various I/O patterns and lets you monitor I/O speed and latency in real time. .SH OPTIONS .TP \fB\-a\fR, \fB\-warmup\fR \fIcount\fR Ignore in statistics first \fIcount\fR requests, default 1. First request usually is much slower due to power-saving features. .TP \fB\-b\fR, \fB\-burst\fR \fIcount\fR Make series of \fIcount\fR requests without delay, default \fB0\fR. Aggressive power-saving features slow down requests even after short delay. .TP \fB\-c\fR, \fB\-count\fR \fIcount\fR Stop after \fIcount\fR requests, default \fB0\fR (infinite). .TP \fB\-e\fR, \fB\-entropy\fR \fIseed\fR Set seed for random number generator, default \fB0\fR (random). .TP \fB\-i\fR, \fB\-interval\fR \fItime\fR Set \fItime\fR between requests, default \fB1s\fR. .TP \fB\-l\fR, \fB\-speed-limit\fR \fIsize\fR Set speed limit in \fIsize\fR per second. Increases interval to request-size / speed. .TP \fB\-r\fR, \fB\-rate-limit\fR \fIcount\fR Set rate limit in \fIcount\fR per second. Increases interval to 1 / rate. .TP \fB\-t\fR, \fB\-min\-time\fR \fItime\fR Minimal valid request time (\fB0us\fR). Too fast requests are ignored in statistics. .TP \fB\-T\fR, \fB\-max\-time\fR \fItime\fR Maximum valid request time. Too slow requests are ignored in statistics. .TP \fB\-s\fR, \fB\-size\fR \fIsize\fR Request size, default \fB4k\fR. .TP \fB\-S\fR, \fB\-work\-size\fR \fIsize\fR Working set size (\fB1m\fR for directory, whole size for file or device). .TP \fB\-o\fR, \fB\-work\-offset\fR \fIsize\fR Starting offset in the file/device (0). .TP \fB\-w\fR, \fB\-work\-time\fR \fItime\fR Stop after \fItime\fR passed, default \fB0\fR (infinite). .TP \fB\-p\fR, \fB\-print\-count\fR \fIcount\fR Print raw statistics for every \fIcount\fR requests (see format below). .TP \fB\-P\fR, \fB\-print\-interval\fR \fItime\fR Print raw statistics for every \fItime\fR. .TP \fB\-A\fR, \fB\-async\fR Use asynchronous I/O (\fBio_setup\fR(2), \fBio_submit\fR(2) etc syscalls). .TP \fB\-B\fR, \fB\-batch\fR Batch mode. Be quiet and print final statistics in raw format. .TP \fB\-C\fR, \fB\-cached\fR Use cached I/O. Suppress cache invalidation via \fBposix_fadvise\fR(2)) before read and \fBfdatasync\fR(2) after each write. .TP \fB\-D\fR, \fB\-direct\fR Use direct I/O (see \fBO_DIRECT\fR in \fBopen\fR(2)). .TP \fB\-I\fR, \fB\-time\fR \fI[format]\fR Print current time for each request. Optional argument defines time format in \fBstrftime\fR(3) notation, default is "%b %d %T" (Jan 01 00:00:00). .TP \fB\-J\fR, \fB\-json\fR Print output in JSON format. .TP \fB\-L\fR, \fB\-linear\fR Use sequential operations rather than random. This also sets default request size to \fB256k\fR (as in \fB-size 256k\fR). .TP \fB\-N\fR, \fB\-nowait\fR Set RWF_NOWAIT on I/O, indicating to the kernel to do not wait if request cannot be executed immediately. (see \fBRWF_NOWAIT\fR in \fBpreadv2\fR(2)) .TP \fB\-R\fR, \fB\-rapid\fR Disk seek rate test, or bandwidth test if used together with \fB-linear\fR. This option suppress human-readable output for each request (as \fB-quiet\fR), sets default interval to zero (\fB-interval 0\fR), stops measurement after 3 seconds (\fB-work-time 3\fR) and increases default working set size to 64m (\fB-work-size 64m\fR). Working set (\fB-work-size\fR) should be increased accordingly if disk has huge hardware cache. .TP \fB\-W\fR, \fB\-write\fR Use writes rather than reads. Safe for temporary file in directory target. Write I/O gives more reliable results for systems where non-cached reads are not supported or cached at some level. .IP Might be \fB*DANGEROUS*\fR for file/device: it will shred your data. In this case should be repeated three times (\fB-WWW\fR). .TP \fB\-G\fR, \fB\-read\-write\fR Alternate read and write requests. .TP \fB\-Y\fR, \fB\-sync\fR Use sync I/O (see \fBO_SYNC\fR in \fBopen\fR(2)). .TP \fB\-y\fR, \fB\-dsync\fR Use data sync I/O (see \fBO_DSYNC\fR in \fBopen\fR(2)). .TP \fB\-k\fR, \fB\-keep\fR Keep and reuse temporary working file "ioping.tmp" (only for directory target). .TP \fB\-q\fR, \fB\-quiet\fR Suppress periodical human-readable output. .TP \fB\-h\fR, \fB\-help\fR Display help message and exit. .TP \fB\-v\fR, \fB\-version\fR Display version and exit. .SS Argument suffixes For options that expect time argument (\fB\-interval\fR, \fB\-print-interval\fR and \fB\-work-time\fR), default is seconds, unless you specify one of the following suffixes (case-insensitive): .TP .BR ns ,\ nsec nanoseconds (a billionth of a second, 1 / 1 000 000 000) .TP .BR us ,\ usec microseconds (a millionth of a second, 1 / 1 000 000) .TP .BR ms ,\ msec milliseconds (a thousandth of a second, 1 / 1 000) .TP .BR s ,\ sec seconds .TP .BR m ,\ min minutes .TP .BR h ,\ hour hours .PP For options that expect "size" argument (\fB\-size\fR, \fB-speed-limit\fR, \fB\-work-size\fR and \fB\-work-offset\fR), default is bytes, unless you specify one of the following suffixes (case-insensitive): .TP .B sector disk sectors (a sector is always 512). .TP .BR KiB ,\ k ,\ kb kilobytes (1 024 bytes) .TP .B page memory pages (a page is always 4KiB). .TP .BR MiB ,\ m ,\ mb megabytes (1 048 576 bytes) .TP .BR GiB ,\ g ,\ gb gigabytes (1 073 741 824 bytes) .TP .BR TiB ,\ t ,\ tb terabytes (1 099 511 627 776 bytes) .PP For options that expect "number" argument (\fB-count\fR and \fB-print-count\fR) you can optionally specify one of the following suffixes (case-insensitive): .TP .B k kilo (thousands, 1 000) .TP .B m mega (millions, 1 000 000) .TP .B g giga (billions, 1 000 000 000) .TP .B t tera (trillions, 1 000 000 000 000) .SH EXIT STATUS Returns \fB0\fR upon success. The following error codes are defined: .TP .B 1 Invalid usage (error in arguments). .TP .B 2 Error during preparation stage. .TP .B 3 Error during runtime. .SH RAW STATISTICS .B ioping -print-count 100 -count 200 -interval 0 -quiet . .ad l .br \f(CW99 10970974 9024 36961531 90437 110818 358872 30756 100 12516420 .br 100 9573265 10446 42785821 86849 95733 154609 10548 100 10649035 .br (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) .br .br (1) count of requests in statistics .br (2) running time (nanoseconds) .br (3) requests per second (iops) .br (4) transfer speed (bytes per second) .br (5) minimal request time (nanoseconds) .br (6) average request time (nanoseconds) .br (7) maximum request time (nanoseconds) .br (8) request time standard deviation (nanoseconds) .br (9) total requests (including warmup, too slow or too fast) .br (10) total running time (nanoseconds) .SH JSON OUTPUT With option -J|--json ioping prints json array of objects: .br \fB[\fR .br \fB...\fR .br { // timestamps "timestamp": (unix time in seconds as float), "localtime": (local time ISO 8601), // io target "target": { "path": (target path), "fstype": (filesystem name), "device": (device name), "device_size": (device size in bytes) }, // io request "io": { "request": (request index), "operation": (request type: "read" | "write"), "size": (request size in bytes), "time": (io time in ns), "ignored": (ignored in statistics: true | false) }, // statistics "stat": { "count": (nr reqeusts), "size": (total io size in bytes), "time": (total io time in ns), "iops": (avg iops), "bps": (avg rate), "min": (min io time in ns), "avg": (avg io time in ns), "max": (max io time in ns), "mdev": (standard deviation in ns) }, // load statistics "load": { "count": (nr requests), "size": (total io size in bytes), "time": (total real time in ns), "iops": (avg iops), "bps": (avg rate) }, .br }, .br \fB...\fR .br \fB]\fR .SH EXAMPLES .TP .B ioping . Show disk I/O latency using the default values and the current directory, until interrupted. This command prepares temporary (unlinked/hidden) working file and reads random chunks from it using non-cached read requests. .TP .B ioping -c 10 -s 1M /tmp Measure latency on \fB/tmp\fR using 10 requests of 1 megabyte each. .TP .B ioping -R /dev/sda Measure disk seek rate. .TP .B ioping -RL /dev/sda Measure disk sequential speed. .TP .B ioping -RLB . | awk '{print $4}' Get disk sequential speed in bytes per second. .TP .B ioping -J . | jq -r --stream 'fromstream(1|truncate_stream(inputs)) | [.localtime, .io.time/1000000] | @tsv' Select localtime and io time in milliseconds from json outout. .SH SEE ALSO .BR iostat (1), .BR dd (1), .BR fio (1), .BR stress (1), .BR stress-ng (1), .BR dbench (1), .BR sysbench (1), .BR fsstress, .BR xfstests, .BR hdparm (8), .BR badblocks (8), .BR .SH HOMEPAGE .UR https://github.com/koct9i/ioping/ .UE . .SH AUTHORS This program was written by Konstantin Khlebnikov .MT koct9i@gmail.com .ME . .br Man-page was written by Kir Kolyshkin .MT kir@openvz.org .ME . ioping-1.3/ioping.c000066400000000000000000001217531430136067000143040ustar00rootroot00000000000000/* * ioping -- simple I/0 latency measuring tool * * Copyright (C) 2011-2015 Konstantin Khlebnikov * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ #ifndef VERSION # define VERSION "1.3" #endif #ifndef EXTRA_VERSION # define EXTRA_VERSION "" #endif #define _GNU_SOURCE #define _FILE_OFFSET_BITS 64 #ifdef __MINGW32__ # define _WIN32_WINNT 0x0600 # define _POSIX_C_SOURCE 200809L #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define HAVE_GETOPT_LONG_ONLY #ifdef __linux__ # include # include # include # define HAVE_CLOCK_GETTIME # define HAVE_POSIX_FADVICE # define HAVE_POSIX_MEMALIGN # define HAVE_MKOSTEMP # define HAVE_DIRECT_IO # define HAVE_LINUX_ASYNC_IO # define HAVE_ERR_INCLUDE # define HAVE_STATVFS # define MAX_RW_COUNT 0x7ffff000 /* 2G - 4K */ # undef RWF_NOWAIT # include # include # ifndef RWF_NOWAIT # define aio_rw_flags aio_reserved1 # endif # undef RWF_NOWAIT # include # ifdef RWF_NOWAIT # define HAVE_LINUX_PREADV2 # endif # ifndef RWF_NOWAIT # define RWF_NOWAIT 0x00000008 # endif # ifndef RWF_HIPRI # define RWF_HIPRI 0x00000001 # endif #else /* __linux__ */ # ifndef RWF_NOWAIT # define RWF_NOWAIT 0 # endif # ifndef RWF_HIPRI # define RWF_HIPRI 0 # endif #endif /* __linux__ */ #ifdef __gnu_hurd__ # include # define HAVE_CLOCK_GETTIME # define HAVE_POSIX_MEMALIGN # define HAVE_MKOSTEMP # define HAVE_ERR_INCLUDE # define HAVE_STATVFS #endif #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) # include # include # include # define HAVE_CLOCK_GETTIME # define HAVE_MKOSTEMP # define HAVE_DIRECT_IO # define HAVE_ERR_INCLUDE # define HAVE_STATVFS #endif #ifdef __DragonFly__ # include # define HAVE_CLOCK_GETTIME # define HAVE_MKOSTEMP # define HAVE_ERR_INCLUDE # define HAVE_STATVFS #endif #ifdef __OpenBSD__ # include # include # include # include # include # define HAVE_CLOCK_GETTIME # define HAVE_POSIX_MEMALIGN # define HAVE_MKOSTEMP # define HAVE_ERR_INCLUDE # define HAVE_STATVFS #endif #ifdef __APPLE__ /* OS X */ # include # include # include # include # define HAVE_FULLFSYNC # define HAVE_NOCACHE_IO # define HAVE_ERR_INCLUDE # define HAVE_STATVFS #endif #ifdef __sun /* Solaris */ # include # include # define HAVE_CLOCK_GETTIME # define HAVE_POSIX_FADVICE # define HAVE_ERR_INCLUDE # define HAVE_STATVFS #endif #ifdef __MINGW32__ /* Windows */ # include # include # include # define HAVE_DIRECT_IO # define HAVE_SYNC_IO # define HAVE_MKOSTEMP /* not required */ #endif #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 # define HAVE_POSIX_FDATASYNC #endif #ifdef O_SYNC # define HAVE_SYNC_IO #endif #ifdef O_DSYNC # define HAVE_DATA_SYNC_IO #endif #ifdef HAVE_STATVFS # include #endif #ifdef HAVE_ERR_INCLUDE # include #else #define ERR_PREFIX "ioping: " void err(int eval, const char *fmt, ...) { va_list ap; va_start(ap, fmt); fprintf(stderr, ERR_PREFIX); vfprintf(stderr, fmt, ap); fprintf(stderr, ": %s\n", strerror(errno)); va_end(ap); exit(eval); } void errx(int eval, const char *fmt, ...) { va_list ap; va_start(ap, fmt); fprintf(stderr, ERR_PREFIX); vfprintf(stderr, fmt, ap); fprintf(stderr, "\n"); va_end(ap); exit(eval); } void warnx(const char *fmt, ...) { va_list ap; va_start(ap, fmt); fprintf(stderr, ERR_PREFIX); vfprintf(stderr, fmt, ap); fprintf(stderr, "\n"); va_end(ap); } #endif /* HAVE_ERR_INCLUDE */ #define NSEC_PER_SEC 1000000000ll #define USEC_PER_SEC 1000000L int timestamp_uptodate; char timestamp_str[64]; char localtime_str[64]; const char *localtime_fmt = "%b %d %T"; #ifdef HAVE_CLOCK_GETTIME static inline long long now(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) err(3, "clock_gettime failed"); return ts.tv_sec * NSEC_PER_SEC + ts.tv_nsec; } static inline void update_timestamp(void) { struct timespec ts; struct tm tm; if (timestamp_uptodate) return; timestamp_uptodate = 1; if (clock_gettime(CLOCK_REALTIME, &ts)) err(3, "clock_gettime failed"); snprintf(timestamp_str, sizeof(timestamp_str), "%f", ts.tv_sec + (double)ts.tv_nsec / NSEC_PER_SEC); localtime_r(&ts.tv_sec, &tm); strftime(localtime_str, sizeof(localtime_str), localtime_fmt, &tm); } #else static inline long long now(void) { struct timeval tv; if (gettimeofday(&tv, NULL)) err(3, "gettimeofday failed"); return tv.tv_sec * NSEC_PER_SEC + tv.tv_usec * 1000ll; } static inline void update_timestamp(void) { struct timeval tv; struct tm tm; if (timestamp_uptodate) return; timestamp_uptodate = 1; if (gettimeofday(&tv, NULL)) err(3, "gettimeofday failed"); snprintf(timestamp_str, sizeof(timestamp_str), "%f", tv.tv_sec + (double)tv.tv_usec / USEC_PER_SEC); time_t t = tv.tv_sec; /* windows bug */ localtime_r(&t, &tm); strftime(localtime_str, sizeof(localtime_str), localtime_fmt, &tm); } #endif /* HAVE_CLOCK_GETTIME */ #ifndef HAVE_MKOSTEMP int mkostemp(char *template, int flags) { int fd; fd = mkstemp(template); if (!flags || fd < 0) return fd; close(fd); return open(template, O_RDWR | flags); } #endif int async = 0; #ifdef __MINGW32__ ssize_t pread(int fd, void *buf, size_t count, off_t offset) { HANDLE h = (HANDLE)_get_osfhandle(fd); DWORD r; OVERLAPPED o; memset(&o, 0, sizeof(o)); o.Offset = offset; o.OffsetHigh = offset >> 32; if (ReadFile(h, buf, count, &r, &o)) return r; if (async && GetLastError() == ERROR_IO_PENDING && GetOverlappedResult(h, &o, &r, TRUE)) return r; return -1; } ssize_t pwrite(int fd, void *buf, size_t count, off_t offset) { HANDLE h = (HANDLE)_get_osfhandle(fd); DWORD r; OVERLAPPED o; memset(&o, 0, sizeof(o)); o.Offset = offset; o.OffsetHigh = offset >> 32; if (WriteFile(h, buf, count, &r, &o)) return r; if (async && GetLastError() == ERROR_IO_PENDING && GetOverlappedResult(h, &o, &r, TRUE)) return r; return -1; } int fsync(int fd) { HANDLE h = (HANDLE)_get_osfhandle(fd); return FlushFileBuffers(h) ? 0 : -1; } int nanosleep(const struct timespec *req, struct timespec *rem) { (void)rem; Sleep(req->tv_sec * 1000 + req->tv_nsec / 1000000); return 0; } #endif /* __MINGW32__ */ #ifndef HAVE_POSIX_MEMALIGN /* don't free it */ int posix_memalign(void **memptr, size_t alignment, size_t size) { char *ptr; ptr = malloc(size + alignment); if (!ptr) return -ENOMEM; *memptr = ptr + alignment - (size_t)ptr % alignment; return 0; } #endif void version(void) { fprintf(stdout, "ioping %s\n", VERSION EXTRA_VERSION); } struct suffix { const char *txt; long long mul; }; static struct suffix int_suffix[] = { { "T", 1000000000000ll }, { "G", 1000000000ll }, { "M", 1000000ll }, { "k", 1000ll }, { "", 1ll }, { "da", 10ll }, { "P", 1000000000000000ll }, { "E", 1000000000000000000ll }, { NULL, 0ll }, }; static struct suffix size_suffix[] = { /* These are first match for printing */ { "PiB", 1ll<<50 }, { "TiB", 1ll<<40 }, { "GiB", 1ll<<30 }, { "MiB", 1ll<<20 }, { "KiB", 1ll<<10 }, { "B", 1 }, { "", 1 }, /* Should be decimal, keep binary for compatibility */ { "k", 1ll<<10 }, { "kb", 1ll<<10 }, { "m", 1ll<<20 }, { "mb", 1ll<<20 }, { "g", 1ll<<30 }, { "gb", 1ll<<30 }, { "t", 1ll<<40 }, { "tb", 1ll<<40 }, { "pb", 1ll<<50 }, { "eb", 1ll<<60 }, { "sector", 512 }, { "page", 4096 }, { NULL, 0ll }, }; static struct suffix time_suffix[] = { { "hour", NSEC_PER_SEC * 60 * 60 }, { "min", NSEC_PER_SEC * 60 }, { "s", NSEC_PER_SEC }, { "ms", 1000000ll }, { "us", 1000ll }, { "ns", 1ll }, { "nsec", 1ll }, { "usec", 1000ll }, { "msec", 1000000ll }, { "", NSEC_PER_SEC }, { "sec", NSEC_PER_SEC }, { "m", NSEC_PER_SEC * 60 }, { "h", NSEC_PER_SEC * 60 * 60 }, { NULL, 0ll }, }; double parse_suffix(const char *str, struct suffix *sfx, long long min, long long max) { char *end; double val, den; val = strtod(str, &end); if (*end == '/') { if (end == str) val = 1; den = strtod(end + 1, &end); if (!den) errx(1, "division by zero in parsing argument: %s", str); val /= den; } for ( ; sfx->txt ; sfx++ ) { if (strcasecmp(end, sfx->txt)) continue; val *= sfx->mul; if (val < min || val > max) errx(1, "integer overflow at parsing argument: %s", str); return val; } errx(1, "invalid suffix: \"%s\"", end); return 0; } int parse_int(const char *str) { return parse_suffix(str, int_suffix, 0, INT_MAX); } ssize_t parse_size(const char *str) { return parse_suffix(str, size_suffix, 0, LONG_MAX); } off_t parse_offset(const char *str) { return parse_suffix(str, size_suffix, 0, LLONG_MAX); } long long parse_time(const char *str) { return parse_suffix(str, time_suffix, 0, LLONG_MAX); } void print_suffix(long long val, struct suffix *sfx) { int precision; while (val < sfx->mul && sfx->mul > 1) sfx++; if (val % sfx->mul == 0) precision = 0; else if (val >= sfx->mul * 10) precision = 1; else precision = 2; printf("%.*f", precision, val * 1.0 / sfx->mul); if (*sfx->txt) printf(" %s", sfx->txt); } void print_int(long long val) { print_suffix(val, int_suffix); } void print_size(long long val) { print_suffix(val, size_suffix); } void print_time(long long val) { print_suffix(val, time_suffix); } char *path = NULL; char *fstype = ""; char *device = ""; long long device_size = 0; int target_fd = -1; void *buf; const char *notice = NULL; int quiet = 0; int time_info = 0; int batch_mode = 0; int direct = 0; int cached = 0; int rw_flags = 0; int syncio = 0; int data_syncio = 0; int randomize = 1; int write_test = 0; int write_read_test = 0; unsigned long long random_entropy = 0; long long period_request = 0; long long period_time = 0; int custom_interval, custom_deadline; long long interval = NSEC_PER_SEC; struct timespec interval_ts; long long deadline = 0; long long speed_limit = 0; double rate_limit = 0; long long min_valid_time = 0; long long max_valid_time = LLONG_MAX; ssize_t default_size = 1<<12; ssize_t size = 0; off_t wsize = 0; off_t temp_wsize = 1<<20; int keep_file = 0; off_t offset = 0; off_t woffset = 0; long long request = 0; long long warmup_request = 1; long long burst = 0; long long burst_request = 0; long long stop_at_request = 0; int json = 0; int json_line = 0; int exiting = 0; const char *options = "hvkALRDNHCWGYBqyi:t:T:w:s:S:c:o:p:P:l:r:a:I::Je:b:"; #ifdef HAVE_GETOPT_LONG_ONLY static struct option long_options[] = { {"help", no_argument, NULL, 'h'}, {"version", no_argument, NULL, 'v'}, {"keep", no_argument, NULL, 'k'}, {"quiet", no_argument, NULL, 'q'}, {"batch", no_argument, NULL, 'B'}, {"time", optional_argument, NULL, 'I'}, {"json", no_argument, NULL, 'J'}, {"rapid", no_argument, NULL, 'R'}, {"linear", no_argument, NULL, 'L'}, {"direct", no_argument, NULL, 'D'}, {"cached", no_argument, NULL, 'C'}, {"nowait", no_argument, NULL, 'N'}, {"hipri", no_argument, NULL, 'H'}, {"sync", no_argument, NULL, 'Y'}, {"dsync", no_argument, NULL, 'y'}, {"async", no_argument, NULL, 'A'}, {"write", no_argument, NULL, 'W'}, {"read-write", no_argument, NULL, 'G'}, {"size", required_argument, NULL, 's'}, {"work-size", required_argument, NULL, 'S'}, {"work-offset", required_argument, NULL, 'o'}, {"count", required_argument, NULL, 'c'}, {"work-time", required_argument, NULL, 'w'}, {"interval", required_argument, NULL, 'i'}, {"burst", required_argument, NULL, 'b'}, {"speed-limit", required_argument, NULL, 'l'}, {"rate-limit", required_argument, NULL, 'r'}, {"warmup", required_argument, NULL, 'a'}, {"min-time", required_argument, NULL, 't'}, {"max-time", required_argument, NULL, 'T'}, {"print-count", required_argument, NULL, 'p'}, {"print-interval", required_argument, NULL, 'P'}, {"entropy", required_argument, NULL, 'e'}, {0, 0, NULL, 0}, }; #endif /* HAVE_GETOPT_LONG */ void usage(FILE *output) { fprintf(output, " Usage: ioping [options...] directory|file|device\n" " ioping -h | -v\n" "\n" " options:\n" " -A, -async use asynchronous I/O\n" " -C, -cached use cached I/O (no cache flush/drop)\n" " -D, -direct use direct I/O (O_DIRECT)\n" " -G, -read-write read-write ping-pong mode\n" " -L, -linear use sequential operations\n" " -N, -nowait use nowait I/O (RWF_NOWAIT)\n" " -H, -hipri use high priority I/O (RWF_HIPRI)\n" " -W, -write use write I/O (please read manpage)\n" " -Y, -sync use sync I/O (O_SYNC)\n" " -y, -dsync use data sync I/O (O_DSYNC)\n" " -R, -rapid test with rapid I/O during 3s (-q -i 0 -w 3)\n" " -k, -keep keep and reuse temporary file (ioping.tmp)\n" "\n" " parameters:\n" " -a, -warmup ignore first requests (1)\n" " -b, -burst make requsts without delay (0)\n" " -c, -count stop after requests\n" " -e, -entropy seed for random number generator (0)\n" " -i, -interval