Process the command line arguments and setup huge pages
()
| 202 | |
| 203 | |
| 204 | def main(): |
| 205 | '''Process the command line arguments and setup huge pages''' |
| 206 | parser = argparse.ArgumentParser( |
| 207 | formatter_class=argparse.RawDescriptionHelpFormatter, |
| 208 | description="Setup huge pages", |
| 209 | epilog=""" |
| 210 | Examples: |
| 211 | |
| 212 | To display current huge page settings: |
| 213 | %(prog)s -s |
| 214 | |
| 215 | To a complete setup of with 2 Gigabyte of 1G huge pages: |
| 216 | %(prog)s -p 1G --setup 2G |
| 217 | """) |
| 218 | parser.add_argument( |
| 219 | '--show', |
| 220 | '-s', |
| 221 | action='store_true', |
| 222 | help="print the current huge page configuration") |
| 223 | parser.add_argument( |
| 224 | '--clear', '-c', action='store_true', help="clear existing huge pages") |
| 225 | parser.add_argument( |
| 226 | '--mount', |
| 227 | '-m', |
| 228 | action='store_true', |
| 229 | help='mount the huge page filesystem') |
| 230 | parser.add_argument( |
| 231 | '--unmount', |
| 232 | '-u', |
| 233 | action='store_true', |
| 234 | help='unmount the system huge page directory') |
| 235 | parser.add_argument( |
| 236 | '--directory', |
| 237 | '-d', |
| 238 | metavar='DIR', |
| 239 | default=HUGE_MOUNT, |
| 240 | help='mount point') |
| 241 | parser.add_argument( |
| 242 | '--user', |
| 243 | '-U', |
| 244 | metavar='UID', |
| 245 | help='set the mounted directory owner user') |
| 246 | parser.add_argument( |
| 247 | '--group', |
| 248 | '-G', |
| 249 | metavar='GID', |
| 250 | help='set the mounted directory owner group') |
| 251 | parser.add_argument( |
| 252 | '--node', '-n', help='select numa node to reserve pages on') |
| 253 | parser.add_argument( |
| 254 | '--pagesize', |
| 255 | '-p', |
| 256 | metavar='SIZE', |
| 257 | help='choose huge page size to use') |
| 258 | parser.add_argument( |
| 259 | '--reserve', |
| 260 | '-r', |
| 261 | metavar='SIZE', |
no test coverage detected