Function report |
Source Code:lib\string_helpers.c |
Create Date:2022-07-28 06:25:50 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:string_get_size - get the size in the specified units*@size: The size to be converted in blocks*@blk_size: Size of the block (use 1 for size in bytes)*@units: units to use (powers of 1000 or 1024)*@buf: buffer to format to*@len: length of buffer* This
Proto:void string_get_size(u64 size, u64 blk_size, const enum string_size_units units, char *buf, int len)
Type:void
Parameter:
| Type | Parameter | Name |
|---|---|---|
| u64 | size | |
| u64 | blk_size | |
| const enum string_size_units | units | |
| char * | buf | |
| int | len |
| 37 | static const char * const units_10[] = {"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"} |
| 40 | static const char * const units_2[] = {"B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"} |
| 43 | static const char * const * const units_str[] = {[use powers of 10^3 (standard SI) ] = units_10, [use binary powers of 2^10 ] = units_2, } |
| 47 | static const unsigned int divisor[] = {[use powers of 10^3 (standard SI) ] = 1000, [use binary powers of 2^10 ] = 1024, } |
| 51 | static const unsigned int rounding[] = {500, 50, 5} |
| 52 | i = 0 |
| 53 | remainder = 0 |
| 57 | tmp[0] = '\0' |
| 77 | i++ |
| 82 | i++ |
| 101 | If units == use binary powers of 2^10 Then |
| 112 | If remainder >= 1000 Then |
| 117 | If j Then |
| 122 | out : |
| 123 | If i >= ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(units_2) Then unit = "UNK" |
| Name | Describe |
|---|---|
| __test_string_get_size | |
| report_hugepages |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |